jars with UTF-8 encoding in matlab

11 Ansichten (letzte 30 Tage)
Christoph Krauß
Christoph Krauß am 16 Apr. 2019
Hello matlabWorld,
i use a jar (1.8) in my matlabCode (2017b) which reads a XML-File by UTF-8 encoding and writes its content to a powerPointFile.
Special chars like 'ü,ä,ö,&....' are not translated correct in that outputFile, like a 'ö' is a 'ö'.....
By the function "feature('locale')" i get this result:
ctype: 'de_DE.windows-1252'
collate: 'de_DE.windows-1252'
time: 'de_DE.windows-1252'
numeric: 'en_US_POSIX.windows-1252'
monetary: 'de_DE.windows-1252'
messages: 'de_DE.windows-1252'
encoding: 'windows-1252'
terminalEncoding: 'IBM850'
jvmEncoding: 'Cp1252'
I have tried to set matlabs encoding with "slCharacterEncoding('UTF-8')" to UTF-8, but it seems to be that the UTF-8 encoding is used in matlab and not for the jars.
Furthermore i found this trick to manipulate the lcdata.xml as follow:
<codeset>
<encoding name="UTF-8">
<encoding_alias name="windows-1252" />
</encoding>
</codeset>
If i run matlab with this code i get by "feature('locale')" this result:
ctype: 'de_DE.windows-1252'
collate: 'de_DE.windows-1252'
time: 'de_DE.windows-1252'
numeric: 'en_US_POSIX.windows-1252'
monetary: 'de_DE.windows-1252'
messages: 'de_DE.windows-1252'
encoding: 'windows-1252'
terminalEncoding: 'IBM850'
jvmEncoding: 'UTF-8'
My jar works correct and the output File shows the correct tranlsation of special chars, but this solution seems to be dirty and there could be trouble with my matlab code which is written in "windows-1252".
Is there a cleaner way to run my jar with UTF-8 encoding?
Thank you!

Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by