C ++ Reading UTF8 buffer using wide stream
My problem is that I have a utf8 formatted buffer stored in std :: string. I want to present him as a source of responsibility to enhance the spirit. How can I do this without converting the entire std :: string to std :: wstring. I would like to have a stream that works as a readonly view from utf8 to whatever wchar_t is on the system.
source to share
You can use u8_to_u32_iterator
. wchar_t
not enough for all characters. You can pass an iterator int32
to invoke spirit functions, or you can simply write a wrapper that converts the int32
iterator to an wchar_t
iterator. Or use u32_to_u16_iterator
for this purpose.
http://www.boost.org/doc/libs/1_53_0/libs/regex/doc/html/boost_regex/ref/internal_details/uni_iter.html
source to share