lundi 2 avril 2018

Confused about C++ UTF8 string

I am writing a program that need to compare 2 unicode string (regex matching to be exact). I am confused about how encoding works.

Here is the code, one string is from file, the other is hard-coded.

code

Here is runtime value of them 2.

file

constant

They are different eventhough I set them to the same value ("// pgr2238 K.Yamazaki@TSR 120227 エラー容認"), and then eventually my code went wrong.

Why are they different? I tried using wstring, wchar, ... but the result always the same. How should I handle this?

Aucun commentaire:

Enregistrer un commentaire