Index: src/Utils.cpp |
=================================================================== |
--- a/src/Utils.cpp |
+++ b/src/Utils.cpp |
@@ -43,9 +43,10 @@ |
return std::string(); |
} |
-v8::Local<v8::String> Utils::ToV8String(const std::string& str) |
+v8::Local<v8::String> Utils::ToV8String(v8::Isolate* isolate, const std::string& str) |
{ |
- return v8::String::New(str.c_str(), str.length()); |
+ return v8::String::NewFromUtf8(isolate, str.c_str(), |
+ v8::String::NewStringType::kInternalizedString, str.length()); |
} |
@@ -84,22 +85,20 @@ |
{ |
HRESULT hr; |
- std::wstring canonizedUrl; |
DWORD canonizedUrlLength = 2049; // de-facto limit of url length |
- |
- canonizedUrl.resize(canonizedUrlLength); |
- hr = UrlCanonicalize(url.c_str(), &canonizedUrl[0], &canonizedUrlLength, 0); |
+ std::wstring canonizedUrl(canonizedUrlLength, L'\0'); |
+ DWORD flags = 0; // nothing special |
+ hr = UrlCanonicalizeW(url.c_str(), &canonizedUrl[0], &canonizedUrlLength, flags); |
canonizedUrl.resize(canonizedUrlLength); |
if (FAILED(hr)) |
{ |
- hr = UrlCanonicalize(url.c_str(), &canonizedUrl[0], &canonizedUrlLength, 0); |
+ hr = UrlCanonicalizeW(url.c_str(), &canonizedUrl[0], &canonizedUrlLength, flags); |
if (FAILED(hr)) |
{ |
throw std::runtime_error("CanonizeUrl failed\n"); |
} |
} |
return canonizedUrl; |
- |
} |
#endif |