Bug 48463 - String::format() on Qt port doesn't work with utf-8
Summary: String::format() on Qt port doesn't work with utf-8
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Ademar Reis
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2010-10-27 13:59 PDT by Ademar Reis
Modified: 2019-02-03 11:12 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 :-)