OO-Snippets: use none ASCII chars in strings

Commons

Keywordsstrings, UNICODE, ASCII, textencoding, RTL_TEXTENCODING_MS_1252, ISO_8859_15, characters, conversion
LanguageCpp
ApplicationOffice
AuthorsStephan Bergman (initial)
Tom Schindl
Supported Versions
Supported OS
Question How to use characters in Strings which are not ASCII?
Answer

UNO uses UNICODE strings. But in many programming languages you may have ASCII strings in a certain encoding. Thus you have to transform your string to a UNICODE string by specifying the encoding of your ASCII string.

For sources written under MS-Windows (R), RTL_TEXTENCODING_MS_1252 should work in most cases.

Code-Snippet-Listing (snippet-source)

Reference <XPropertyReplace> rPropRepl
...
// insert a Euro currency symbol
rPropRepl->setReplaceString(OUString("&164;", 1, ISO_8859_15 ));

Changelog

DateUserModification
2004-06-22tomsontomModified to match new snippet-DTD
0000-00-00steInitial version

and