Search code examples
unicodelazaruscodepages

How to convert e.g. CodePage 1250 (Windows-1250) to Unicode using Lazarus


Objective:

Using Lazarus create a function for conversion strings from CodePage 1250 (Windows-1250) into Unicode.


Solution

  • I found only one way to do this effectively, feel free to add your own research.

    uses
      LConvEncoding;
    

    ...

    function ConvertStrFromCP1250ToUnicode(TextAsCP1250: string): unicodestring;
    
    var
      TextAsUTF8: string;
    
    begin
    
      TextAsUTF8 := CP1250ToUTF8(TextAsCP1250);
    
      Result := TextAsUTF8;
    
    end;