I have a database table that contains Swedish/Norwegian strings.
When I query some data, I get output like this:
set names latin1;
<
These words "ø ö ä" with utf8 takes 2 bytes, so did you forget use wchar or utf string?
Here's my test code in python:
s = ["Kid Interiør","Bwg Homes","If Skadeförsäkring"]
for w in s:
print '|',w.ljust(20,' '),'|'
the result is as the same as your program print out.
all I need to do is change the encoding of string s
:
s = [u"Kid Interiør",u"Bwg Homes",u"If Skadeförsäkring"]
for w in s:
print '|',w.ljust(20,' '),'|'
the result is
| Kid Interiør |
| Bwg Homes |
| If Skadeförsäkring |
I haven't test in c++, but I suggest you can use wchar, std::wcout.