How-To convert mutated vowels (Umlaute) to readable text

This is a snippet to convert “German Umlaute” to the correct text if you have Codepage problems.

expected output:ä ö ü ß
actual output:ä ö ü ß
FormatTextAsUTF8(Text : Text[1024]) NAVText : Text[1024]
FOR Counter := 1 TO STRLEN(Text) DO BEGIN
  Char := COPYSTR(Text,Counter,1);
  IF Char[1] = 195 THEN  // C3 = Steuerzeichen für Umlaute
    IsC3 := TRUE
  ELSE BEGIN
    IF IsC3 THEN BEGIN
      CASE Char[1] OF
        132:
          Char := 'Ä';
        150:
          Char := 'Ö';
        156:
          Char := 'Ü';
        164:
          Char := 'ä';
        182:
          Char := 'ö';
        188:
          Char := 'ü';
        159:
          Char := 'ß';
        ELSE
          Char := '?';
      END;
      IsC3 := FALSE;
    END;
    NAVText := NAVText + Char;
  END;
END;

EXIT(NAVText);
NameType
IsC3Boolean
CharText
CounterInteger

... is a technical consultant and developer at Comsol Unternehmenslösungen AG in Kronberg/Taunus. Major tasks are the architecture and implementation of complex, usually cross-system applications in and around Microsoft Dynamics 365 Business Central.

Leave a Reply

Your email address will not be published. Required fields are marked *