Skip to content
  • LRN's avatar
    g_date_time_format_locale: ensure locale encoding is used · 6a1e8e8f
    LRN authored
    Fallback code for g_date_time_format_locale() fetches translated
    strings (such as day and month names) from .mo catalogues via
    gettext. These strings always come in UTF-8 encoding, because
    that is the encoding that glib sets when it initializes gettext
    for itself.
    However, the non-fallback code uses nl_langinfo() and expects
    its results to be in locale-dependent encoding.
    
    This mismatch can result in UTF-8 strings being converted to UTF-8,
    producing gibberish.
    
    Fix this by converting UTF-8 strings to locale-dependent encoding
    before using them. Also fix the code that was already doing the locale->UTF-8
    conversion to not convert the strings when they are already UTF-8-encoded.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766092
    6a1e8e8f