# Exporting German Umlauts to PDF and importing them doesn't work - character encoding problem

I am using Mathematica 9.0.0.0 under German Windows 32bit. I am on trying to export and import German text to PDF and re-import it. It seems that there is a confusion about the character encoding. It obviously differs between Export and Import. However, nothing related to the encoding is described in the PDF documentation, nor does specifying CharacterEncoding in PDF import and export seem to make any difference.

ImportString[ExportString[
"This is a string. Aber was ist mit äöü, ß und ÄÖÜ? Also x\.b2 und \y\.b3 measured in µm",
"PDF"]]


I wonder if there is a work-around which doesn't require a complete re-mapping. PDF export is slow, and doing it character by character will probably take hours.

• I got most of it to work now. The String itself has to be coded using UTF-8 as in CharacterEncoding -> "UTF-8" inside the Style function. The \.b2 and \.b3 don't work yet. Maybe one day someone will find out how to make these work, too. – Juergen Bosse Apr 1 '13 at 10:59
• Ok, the FontFamily matters, too: This finally works! Style["This is a string. Aber was ist mit äöü, ß und ÄÖÜ? Also x\.b2 \ und y\.b3 measured in \[Micro]m", FontFamily -> "Arial", CharacterEncoding -> "ASCII"] – Juergen Bosse Apr 1 '13 at 11:20

So PDF Import accepts a CharacterEncoding option, but it seems to ignore it. Exporting in UTF-8 or in ASCII gives the best results, with the former supporting the Euro symbol € and the latter supporting the ² and ³ symbols. Life is all about choice I guess.

The String itself has to be encoded using Style, and the FontFamily matters, too:

ImportString[
ExportString[
Style["This is a string. Aber was ist mit äöü, ß und ÄÖÜ? Also x\.b2 und y\.b3 measured in \[Micro]m",
FontFamily -> "Arial", CharacterEncoding -> "ASCII"],
"PDF"]
]


Note that, on import, you can give the option "TextMode" -> "Outlines" which results in FilledCurve entities being used instead of text entities. This is then highly portable and probably the safest way to ensure the correct appearance across systems at the expense of memory of course.

I have also been able to convert the filled curves to 3D outlines. This looks pretty cool and probably qualifies as a "neat example". I will post this separately and provide a link here.