Ticket #9247: locale_icu_fix.patch
File locale_icu_fix.patch, 6.3 KB (added by , 9 years ago) |
---|
-
libs/locale/src/icu/formatter.cpp
240 240 sdf->toPattern(tmp); 241 241 } 242 242 else { 243 tmp= alt;243 tmp=icu::UnicodeString(alt, -1, US_INV); 244 244 } 245 245 return tmp; 246 246 … … 250 250 { 251 251 switch(c) { 252 252 case 'a': // Abbr Weekday 253 return "EE";253 return UNICODE_STRING_SIMPLE("EE"); 254 254 case 'A': // Full Weekday 255 return "EEEE";255 return UNICODE_STRING_SIMPLE("EEEE"); 256 256 case 'b': // Abbr Month 257 return "MMM";257 return UNICODE_STRING_SIMPLE("MMM"); 258 258 case 'B': // Full Month 259 return "MMMM";259 return UNICODE_STRING_SIMPLE("MMMM"); 260 260 case 'c': // DateTile Full 261 261 { 262 262 if(cache) … … 270 270 // case 'C': // Century -> 1980 -> 19 271 271 // retur 272 272 case 'd': // Day of Month [01,31] 273 return "dd";273 return UNICODE_STRING_SIMPLE("dd"); 274 274 case 'D': // %m/%d/%y 275 return "MM/dd/YY";275 return UNICODE_STRING_SIMPLE("MM/dd/YY"); 276 276 case 'e': // Day of Month [1,31] 277 return "d";277 return UNICODE_STRING_SIMPLE("d"); 278 278 case 'h': // == b 279 return "MMM";279 return UNICODE_STRING_SIMPLE("MMM"); 280 280 case 'H': // 24 clock hour 00,23 281 return "HH";281 return UNICODE_STRING_SIMPLE("HH"); 282 282 case 'I': // 12 clock hour 01,12 283 return "hh";283 return UNICODE_STRING_SIMPLE("hh"); 284 284 case 'j': // day of year 001,366 285 return "D";285 return UNICODE_STRING_SIMPLE("D"); 286 286 case 'm': // month as [01,12] 287 return "MM";287 return UNICODE_STRING_SIMPLE("MM"); 288 288 case 'M': // minute [00,59] 289 return "mm";289 return UNICODE_STRING_SIMPLE("mm"); 290 290 case 'n': // \n 291 return "\n";291 return UNICODE_STRING_SIMPLE("\n"); 292 292 case 'p': // am-pm 293 return "a";293 return UNICODE_STRING_SIMPLE("a"); 294 294 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"); 296 296 case 'R': // %H:%M 297 return "HH:mm";297 return UNICODE_STRING_SIMPLE("HH:mm"); 298 298 case 'S': // second [00,61] 299 return "ss";299 return UNICODE_STRING_SIMPLE("ss"); 300 300 case 't': // \t 301 return "\t";301 return UNICODE_STRING_SIMPLE("\t"); 302 302 case 'T': // %H:%M:%S 303 return "HH:mm:ss";303 return UNICODE_STRING_SIMPLE("HH:mm:ss"); 304 304 /* case 'u': // weekday 1,7 1=Monday 305 305 case 'U': // week number of year [00,53] Sunday first 306 306 case 'V': // week number of year [01,53] Moday first … … 325 325 ); 326 326 } 327 327 case 'y': // Year [00-99] 328 return "YY";328 return UNICODE_STRING_SIMPLE("YY"); 329 329 case 'Y': // Year 1998 330 return "YYYY";330 return UNICODE_STRING_SIMPLE("YYYY"); 331 331 case 'Z': // timezone 332 return "vvvv";332 return UNICODE_STRING_SIMPLE("vvvv"); 333 333 case '%': // % 334 return "%";334 return UNICODE_STRING_SIMPLE("%"); 335 335 default: 336 return "";336 return UNICODE_STRING_SIMPLE(""); 337 337 } 338 338 } 339 339 … … 352 352 c=ftime[i]; 353 353 } 354 354 if(escaped) { 355 result+= "'";355 result+=UNICODE_STRING_SIMPLE("'"); 356 356 escaped=false; 357 357 } 358 358 result+=strftime_to_icu_symbol(c,locale); 359 359 } 360 360 else if(c=='\'') { 361 result+= "''";361 result+=UNICODE_STRING_SIMPLE("''"); 362 362 } 363 363 else { 364 364 if(!escaped) { 365 result+= "'";365 result+=UNICODE_STRING_SIMPLE("'"); 366 366 escaped=true; 367 367 } 368 368 result+=c; … … 369 369 } 370 370 } 371 371 if(escaped) 372 result+= "'";372 result+=UNICODE_STRING_SIMPLE("'"); 373 373 return result; 374 374 } 375 375 -
libs/locale/src/icu/time_zone.cpp
50 50 return icu::TimeZone::createDefault(); 51 51 } 52 52 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()))); 54 54 } 55 55 } 56 56 … … 211 211 { 212 212 213 213 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()))); 215 215 } 216 216 std::auto_ptr<icu::TimeZone> tz(icu::TimeZone::createDefault()); 217 217 icu::UnicodeString id; … … 226 226 // if we failed fallback to ICU's time zone 227 227 return tz.release(); 228 228 } 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()))); 230 230 } 231 231 #endif // bug workaround 232 232