String literals, ASCII vs UTF-8

Michael Meeks michael.meeks at suse.com
Tue Feb 28 03:41:49 PST 2012


On Tue, 2012-02-28 at 12:30 +0100, Lubos Lunak wrote:
> RTL_CONSTASCII_USTRINGPARAM. While I was ambivalent about it, I now think we 
> should go with ASCII only, unless explicitly marked otherwise.

	:-) your arguments make sense to me at least.

     OUString( const char (&literal)[ N ] )
     {
         pData = 0;
-        rtl_string2UString( &pData, literal, N - 1, RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS );
+        rtl_string2UString( &pData, literal, N - 1, RTL_TEXTENCODING_ASCII_US, 0 );

	I would really prefer to use a new:

        rtl_uString_newFromAsciiL( &pNew, literal, N - 1 );

	method - which should shrink the call-site, and allow for a rather
better implementation vs.

	rtl_impl_convertUStringToString

	which has no fast-case for ASCII, and it requires these two extra
parameters we don't need to setup in each case :-)

	Otherwise, this looks like some really nice work :-)

	Thanks !

		Michael.

-- 
michael.meeks at suse.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list