Ticket #9247: locale_icu_fix.patch

File locale_icu_fix.patch, 6.3 KB (added by hvemha@…, 9 years ago)
  • libs/locale/src/icu/formatter.cpp

     
    240240                sdf->toPattern(tmp);
    241241            }
    242242            else {
    243                 tmp=alt;
     243                tmp=icu::UnicodeString(alt, -1,  US_INV);
    244244            }
    245245            return tmp;
    246246
     
    250250        {
    251251            switch(c) {
    252252            case 'a': // Abbr Weekday
    253                 return "EE";
     253                return UNICODE_STRING_SIMPLE("EE");
    254254            case 'A': // Full Weekday
    255                 return "EEEE";
     255                return UNICODE_STRING_SIMPLE("EEEE");
    256256            case 'b': // Abbr Month
    257                 return "MMM";
     257                return UNICODE_STRING_SIMPLE("MMM");
    258258            case 'B': // Full Month
    259                 return "MMMM";
     259                return UNICODE_STRING_SIMPLE("MMMM");
    260260            case 'c': // DateTile Full
    261261                {
    262262                    if(cache)
     
    270270            //  case 'C': // Century -> 1980 -> 19
    271271            //  retur
    272272            case 'd': // Day of Month [01,31]
    273                 return "dd";
     273                return UNICODE_STRING_SIMPLE("dd");
    274274            case 'D': // %m/%d/%y
    275                 return "MM/dd/YY";
     275                return UNICODE_STRING_SIMPLE("MM/dd/YY");
    276276            case 'e': // Day of Month [1,31]
    277                 return "d";
     277                return UNICODE_STRING_SIMPLE("d");
    278278            case 'h': // == b
    279                 return "MMM";
     279                return UNICODE_STRING_SIMPLE("MMM");
    280280            case 'H': // 24 clock hour 00,23
    281                 return "HH";
     281                return UNICODE_STRING_SIMPLE("HH");
    282282            case 'I': // 12 clock hour 01,12
    283                 return "hh";
     283                return UNICODE_STRING_SIMPLE("hh");
    284284            case 'j': // day of year 001,366
    285                 return "D";
     285                return UNICODE_STRING_SIMPLE("D");
    286286            case 'm': // month as [01,12]
    287                 return "MM";
     287                return UNICODE_STRING_SIMPLE("MM");
    288288            case 'M': // minute [00,59]
    289                 return "mm";
     289                return UNICODE_STRING_SIMPLE("mm");
    290290            case 'n': // \n
    291                 return "\n";
     291                return UNICODE_STRING_SIMPLE("\n");
    292292            case 'p': // am-pm
    293                 return "a";
     293                return UNICODE_STRING_SIMPLE("a");
    294294            case 'r': // time with AM/PM %I:%M:%S %p
    295                 return "hh:mm:ss a";
     295                return UNICODE_STRING_SIMPLE("hh:mm:ss a");
    296296            case 'R': // %H:%M
    297                 return "HH:mm";
     297                return UNICODE_STRING_SIMPLE("HH:mm");
    298298            case 'S': // second [00,61]
    299                 return "ss";
     299                return UNICODE_STRING_SIMPLE("ss");
    300300            case 't': // \t
    301                 return "\t";
     301                return UNICODE_STRING_SIMPLE("\t");
    302302            case 'T': // %H:%M:%S
    303                 return "HH:mm:ss";
     303                return UNICODE_STRING_SIMPLE("HH:mm:ss");
    304304/*          case 'u': // weekday 1,7 1=Monday
    305305            case 'U': // week number of year [00,53] Sunday first
    306306            case 'V': // week number of year [01,53] Moday first
     
    325325                    );
    326326                }
    327327            case 'y': // Year [00-99]
    328                 return "YY";
     328                return UNICODE_STRING_SIMPLE("YY");
    329329            case 'Y': // Year 1998
    330                 return "YYYY";
     330                return UNICODE_STRING_SIMPLE("YYYY");
    331331            case 'Z': // timezone
    332                 return "vvvv";
     332                return UNICODE_STRING_SIMPLE("vvvv");
    333333            case '%': // %
    334                 return "%";
     334                return UNICODE_STRING_SIMPLE("%");
    335335            default:
    336                 return "";
     336                return UNICODE_STRING_SIMPLE("");
    337337            }
    338338        }
    339339
     
    352352                        c=ftime[i];
    353353                    }
    354354                    if(escaped) {
    355                         result+="'";
     355                        result+=UNICODE_STRING_SIMPLE("'");
    356356                        escaped=false;
    357357                    }
    358358                    result+=strftime_to_icu_symbol(c,locale);
    359359                }
    360360                else if(c=='\'') {
    361                         result+="''";
     361                        result+=UNICODE_STRING_SIMPLE("''");
    362362                }
    363363                else {
    364364                    if(!escaped) {
    365                         result+="'";
     365                        result+=UNICODE_STRING_SIMPLE("'");
    366366                        escaped=true;
    367367                    }
    368368                    result+=c;
     
    369369                }
    370370            }
    371371            if(escaped)
    372                 result+="'";
     372                result+=UNICODE_STRING_SIMPLE("'");
    373373            return result;
    374374        }
    375375       
  • libs/locale/src/icu/time_zone.cpp

     
    5050                    return icu::TimeZone::createDefault();
    5151                }
    5252                else {
    53                     return icu::TimeZone::createTimeZone(time_zone.c_str());
     53                    return icu::TimeZone::createTimeZone(icu::UnicodeString(time_zone.c_str(), static_cast<int32_t>(time_zone.length())));
    5454                }
    5555            }
    5656
     
    211211            {
    212212
    213213                if(!time_zone.empty()) {
    214                     return icu::TimeZone::createTimeZone(time_zone.c_str());
     214                    return icu::TimeZone::createTimeZone(icu::UnicodeString(time_zone.c_str(), static_cast<int32_t>(time_zone.length())));
    215215                }
    216216                std::auto_ptr<icu::TimeZone> tz(icu::TimeZone::createDefault());
    217217                icu::UnicodeString id;
     
    226226                    // if we failed fallback to ICU's time zone
    227227                    return tz.release();
    228228                }
    229                 return icu::TimeZone::createTimeZone(real_id.c_str());
     229                return icu::TimeZone::createTimeZone(icu::UnicodeString(real_id.c_str(), static_cast<int32_t>(real_id.length())));
    230230            }
    231231            #endif // bug workaround
    232232