How to save string to text file with ASCII encoding in Windows store apps/WinRT?

后端 未结 1 396
温柔的废话
温柔的废话 2020-12-21 23:08

I am trying hard to save some string to a text file with ASCII encoding in a win8 app project. Below is some of the code snippet:

StorageFi         


        
相关标签:
1条回答
  • 2020-12-21 23:26

    As far as I know, Windows Store apps cannot use non-Unicode encodings. But if your string only contains characters with codepoints between U+00 and U+7F (0..127) then UTF8 and ASCII are identical, because UTF8 was designed to be ASCII-compatible.

    So, just encode it as UTF8 and decode as ASCII.

    0 讨论(0)
提交回复
热议问题