• Jungshik Shin's avatar
    Use fromUTF8() for UnicodeString construction from UTF-8 · e58fa0ba
    Jungshik Shin authored
    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: default avatarPeter Kasting <pkasting@chromium.org>
    Commit-Queue: Jungshik Shin <jshin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#524586}
    e58fa0ba
idn_spoof_checker.cc 18.4 KB