There are couple of ways to handle German characters like Ü,Ä,Ö,ä,ö,ü,ß in XML and Oracle queries.
In case of XML, we use the XMLserialize function with encoding options.
The most common encoding options for printing German characters are:
The commonly used encoding option UTF-8 does not support German characters.
The below are the programming way of explaining these encoding options:
In case of XML, we use the XMLserialize function with encoding options.
The most common encoding options for printing German characters are:
The commonly used encoding option UTF-8 does not support German characters.
The below are the programming way of explaining these encoding options:
SELECT XMLSerialize(DOCUMENT
XMLType('<BODY>äÄßÜüÜberwachung</BODY>') as BLOB ENCODING 'UTF-8'
VERSION '1.0' INDENT SIZE = 2)
AS xmlserialize_doc FROM DUAL
As you see the UTF-8 encoding option does not support German characters.
Lets see the other options.
SELECT XMLSerialize(DOCUMENT
XMLType('<BODY>äÄßÜüÜberwachung</BODY>') as BLOB ENCODING
'ISO-8859-1' VERSION '1.0' INDENT SIZE = 2)
AS xmlserialize_doc FROM DUAL;
This encoding is working :)
SELECT XMLSerialize(DOCUMENT
XMLType('<BODY>äÄßÜüÜberwachung</BODY>') as BLOB ENCODING
'windows-1252' VERSION '1.0' INDENT SIZE = 2)
AS xmlserialize_doc FROM DUAL;
This option is working as well.
The only problem with this approach is that output will be in BLOB format and we need a function to convert that into CLOB to use it.
We can use the below approach as well to use it in the oracle objects like package or function:
SELECT REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE (
REPLACE
(REPLACE ('ÜäÖößü', 'ß', 'ss'),
'Ü',
'Ue'),
'Ö',
'Oe'),
'Ä',
'Ae'),
'ä',
'ae'),
'ü',
'ue'),
'ö',
'oe')
FROM DUAL;
This will replace the German characters into the English equivalent.
This approach will be useful if the encoding option is not supported by systems like Interfaces.
The below are the HTML notation for the German characters:
- ä -> ä
- Ä -> Ä
- ö -> ö
- Ö -> Ö
- ü -> ü
- Ü -> Ü
- ß -> ß
- € -> €
- & -> &
- < -> <
- > -> >
- „ -> "
- © -> ©
- • -> •
- ™ -> ™
- ® -> ®
- § -> §
- | -> |
This is 9 years old, but "UTF-8 does not support german umlauts" is plaing wrong. It is just a problem with the way you *view* the text.
ReplyDelete