How to read unicode (utf-8) / binary file line by line

前端 未结 6 1709
醉酒成梦
醉酒成梦 2020-12-16 15:56

Hi programmers,

I want read line by line a Unicode (UTF-8) text file created by Notepad, i don\'t want display the Unicode string in the screen, i w

6条回答
  •  感动是毒
    2020-12-16 16:43

    A nice property of UTF-8 is that you do not need to decode in order to compare it. The order returned from strcmp will be the same whether you decode it first or not. So just read it as raw bytes and run strcmp.

提交回复
热议问题