Use fromUTF8() for UnicodeString construction from UTF-8
Chrome's copy of ICU is built with U_CHARSET_IS_UTF8=1 so that |char *| buffer is treated as UTF-8 when constructing UnicodeString() regardless of the default encoding of the current locale on Linux or non-Unicode code page on Windows. However, some Linux distros do not set U_CHARSET_IS_UTF=1 when building ICU and Chromium build with system_icu crashes when Chromium is run in non-UTF-8 locale (e.g. 'C'). To make Chromium work in a non-UTF-8 locale (which is pretty rare these days), use 'icu::UnicodeString::fromUTF8(StringPiece)' instead of 'icu::UnicodeString(const char*)'. Bug: 772655 Test: components_unittests --gtest_filter=*IDN* Test: Chromium built with system_icu does not crash in C locale. Change-Id: I0daa284ec06b8e83814fc70eb8e9e5c96444ebfa Reviewed-on: https://chromium-review.googlesource.com/831247Reviewed-by:Peter Kasting <pkasting@chromium.org> Commit-Queue: Jungshik Shin <jshin@chromium.org> Cr-Commit-Position: refs/heads/master@{#524586}
Showing
Please register or sign in to comment