Heinz M.
Heinz M.

Reputation: 694

Xcode 16.0 doesn't display German Umlaute in source files

I am processing Latex source.tex files with a Swift app. The source files contain German Umlaute. After adding the source files to a project and opening the files, the Umlaute are not displayed correctly. I am pretty sure it is an encoding problem. I wrote the following text to a Tex file, using TexShop V5.46:

Öse
Übel
Ärger
Dösen
Müde
Mängel
Schließlich

I saved the same content in three different files, which were encoded in UTF-8, ISO Latin 1 and Iso Latin 2.

I copied the files to a Swift project and opened the files. All of them displayed the same content:

÷se
‹bel
ƒrger
Dˆsen
M¸de
M‰ngel
Schliefllich

In the file Inspector I tried to change the Text encoding. However, there was no change at all.

By the way. Reading the file content to a String variable with the command:

let aString = try String(contentsOf: latexFileURL, encoding: .isoLatin2)

results in a valid input. Displaying the String with a SwiftUI TextView the Umlaute are displayed as expected.

Has anybody a solution, that the Umlaute are displayed properly in the Xcode text editor?

Upvotes: -1

Views: 48

Answers (1)

Heinz M.
Heinz M.

Reputation: 694

I have got the solution:

  1. Open TexShop
  2. Select Preferences
  3. Set coding to Unicode (UTF-8)
  4. Close TexShop
  5. Open your project in Xcode
  6. Select the source.tex file with the right mouse button
  7. Select Open with External Editor
  8. TexShop opens and a warning pops up, that the file is opened with a wrong encoding
  9. Press OK
  10. Save the file (command S)
  11. Close the file
  12. Umlaute in Xcode are displayed correctly.

Upvotes: 0

Related Questions