LoadFromFile with Unicode data

后端 未结 2 485
攒了一身酷
攒了一身酷 2020-12-31 18:24

My input file(f) has some Unicode (Swedish) that isn\'t being read correctly.

Neither of these approaches works, although they give different results:



        
2条回答
  •  一生所求
    2020-12-31 18:45

    I assume that you mean 'UTF-8' when you say 'Unicode'.

    If you know that the file is UTF-8, then do

    LoadFromFile(f, TEncoding.UTF8).
    

    To save:

    SaveToFile(f, TEncoding.UTF8);
    

    (The GetOEMCP WinAPI function is for old 255-character character sets.)

提交回复
热议问题