# # # patch "ChangeLog" # from [538d13f3793a2762a6bf9b1c8ad56a8d8f1fbbf0] # to [ac25e1e2da211bf6cac621246df50e70bb06d24a] # # patch "charset.cc" # from [cf621c56614deb11c2b07a76af0ee18010b0e5be] # to [1a05a6b0c65572723948d3213f8b5bcfc3ed910b] # ============================================================ --- ChangeLog 538d13f3793a2762a6bf9b1c8ad56a8d8f1fbbf0 +++ ChangeLog ac25e1e2da211bf6cac621246df50e70bb06d24a @@ -1,3 +1,11 @@ +2007-02-07 Zack Weinberg + + * charset.cc (system_to_utf8): Move below system_charset_is_utf8 + etc; add the same short-circuit logic that utf8_to_system + has. (In addition to being a speed win, this avoids problems with + buggy iconv implementations that don't implement the encoding that + their own locale library reports for the "C" locale. Bleah.) + 2007-02-05 Markus Schiltknecht * tests/test_a_merge_8/*: @@ -23,7 +31,7 @@ 2007-02-05 Derek Scherger (via Richard Levitte ) @@ -53,7 +61,7 @@ 2007-01-29 Thomas Keller - * added some lua hooks to run a script after revs or certs have + * added some lua hooks to run a script after revs or certs have arrived via netsync for a particular branch 2007-01-29 Matthew Gregan ============================================================ --- charset.cc cf621c56614deb11c2b07a76af0ee18010b0e5be +++ charset.cc 1a05a6b0c65572723948d3213f8b5bcfc3ed910b @@ -59,15 +59,6 @@ charset_convert(string const & src_chars } } -void -system_to_utf8(external const & ext, utf8 & utf) -{ - string out; - charset_convert(system_charset(), "UTF-8", ext(), out); - utf = utf8(out); - I(utf8_validate(utf)); -} - size_t display_width(utf8 const & utf) { @@ -174,6 +165,23 @@ utf8_to_system(utf8 const & utf, externa ext = external(out); } +void +system_to_utf8(external const & ext, utf8 & utf) +{ + if (system_charset_is_utf8()) + utf = utf8(ext()); + else if (system_charset_is_ascii_extension() + && is_all_ascii(ext())) + utf = utf8(ext()); + else + { + string out; + charset_convert(system_charset(), "UTF-8", ext(), out); + utf = utf8(out); + I(utf8_validate(utf)); + } +} + // utf8_validate and the helper functions is_valid_unicode_char and // utf8_consume_continuation_char g_utf8_validate and supporting functions // from the file gutf8.c of the GLib library.