Unknown characters

后端 未结 1 1776
情话喂你
情话喂你 2021-01-19 13:56

I read the string from file with encoding \"UTF-8\". And I need to match it to a expression. The first character of the file is #, but in the string the first i

相关标签:
1条回答
  • 2021-01-19 14:51

    Some editors (like notepad) adds BOM (byte order mask) signature when saved UTF-8 text. You should check 0xEF, 0xBB, 0xBF bytes before read string from such file and skip them if they exists.

    Another way is do not use notepad for editing UTF-8 texts, get other program like Notepad++, Kate or whatever with witch you can control adding BOM.

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