Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1296)

Unified Diff: runtime/bin/utils_win.h

Issue 2698813002: [dart:io][windows] Make unicode characters display correctly. (Closed)
Patch Set: Make tests pass Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/bin/utils_win.h
diff --git a/runtime/bin/utils_win.h b/runtime/bin/utils_win.h
index a46bbb83988bf75cd63533a0bc6f7de00d8f6d12..fb018450c1411caa3c5c44c94a72ed5fcce91eab 100644
--- a/runtime/bin/utils_win.h
+++ b/runtime/bin/utils_win.h
@@ -77,10 +77,19 @@ class Utf8ToWideScope {
wide_ = wide;
}
+ Utf8ToWideScope(const char* utf8, intptr_t length) {
+ int wide_len = MultiByteToWideChar(CP_UTF8, 0, utf8, length, NULL, 0);
+ wchar_t* wide = new wchar_t[wide_len];
+ MultiByteToWideChar(CP_UTF8, 0, utf8, length, wide, wide_len);
+ length_ = wide_len;
+ wide_ = wide;
+ }
+
~Utf8ToWideScope() { delete[] wide_; }
wchar_t* wide() const { return wide_; }
intptr_t length() const { return length_; }
+ intptr_t size_in_bytes() const { return length_ * sizeof(*wide_); }
private:
intptr_t length_;

Powered by Google App Engine
This is Rietveld 408576698