c++ - How do I search for end of line ('\n') in a UTF-8 text? -
i have c++ library provides i/o device interface (including implementation files). provides utf-8 string class. now, need read line iodevice
. reason i'm mentioning library can't, example, open file std::ifstream
, read using std::wbuffer_convert<std::codecvt_utf8<wchar_t>>
. don't mind using stdlib (in fact, prefer it), need read line iodevice
, return string
.
now, specific question: if read file byte byte, safe assume byte value '\n'
in fact new line symbol, , not trailing part of different multi-byte symbol?
is safe assume byte value
'\n'
in fact new line symbol, , not trailing part of different multi-byte symbol?
yes, in utf-8, ascii bytes not occur in non-ascii code points.
Comments
Post a Comment