Bug 48463

Summary: String::format() on Qt port doesn't work with utf-8
Product: WebKit Reporter: Ademar Reis <ademar>
Component: PlatformAssignee: Ademar Reis <ademar>
Status: RESOLVED WONTFIX    
Severity: Normal Keywords: Qt
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
See Also: https://bugs.webkit.org/show_bug.cgi?id=37327

Description Ademar Reis 2010-10-27 13:59:21 PDT
String::format() on the Qt port doesn't work with utf-8 strings because it calls QString::vsprintf(), which handles cformat as a
Latin1 string by default[1] (unless changed by QTextCodec::setCodecForCStrings(), which is global and non-thread-safe).

Because of that we can't, for example, reuse the current strings in the WebKit2 LocalizationStrategy[2], not to mention potential bugs somewhere else due to this unexpected limitation.

See also bug 18994 for a long discussion on String::format() pitfalls and bug 37327 that lists several places where String::format() is used with utf-8 strings.

1. http://doc.trolltech.com/4.7/qtextcodec.html#setCodecForCStrings
2. WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Comment 1 Ademar Reis 2010-10-27 14:23:09 PDT
I've just noticed that the plan is to eliminate String::format() completely. See bug 30342 :-)