std::strerror and UTF-8

W

Wolfgang Meier

Hi,

I use a library (libphysfs) that calls std::strerror to return a
human-readable error message. According to the docs I read,
std::strerror will return this error message localized and encoded
according to LC_MESSAGES.

Patching the library is no option, so is there any portable way of
obtaining the error message encoded as UTF-8, e.g. by converting it?

Thanks in advance,

Wolf
 
R

Roland Pibinger

I use a library (libphysfs) that calls std::strerror to return a
human-readable error message. According to the docs I read,
std::strerror will return this error message localized and encoded
according to LC_MESSAGES.
Patching the library is no option, so is there any portable way of
obtaining the error message encoded as UTF-8, e.g. by converting it?

What makes you think the returned message is not UTF-8 which is
"backwards compatible with ASCII"? See:
http://en.wikipedia.org/wiki/Utf-8

Best wishes,
Roland Pibinger
 
A

AnonMail2005

Wolfgang said:
Hi,

I use a library (libphysfs) that calls std::strerror to return a
human-readable error message. According to the docs I read,
std::strerror will return this error message localized and encoded
according to LC_MESSAGES.

Patching the library is no option, so is there any portable way of
obtaining the error message encoded as UTF-8, e.g. by converting it?

Thanks in advance,

Wolf
If, in fact, you do need to convert, look into the GNU iconv library.
It's a widely used, easy to use character conversion library.
 
W

Wolfgang Meier

If, in fact, you do need to convert, look into the GNU iconv library.
It's a widely used, easy to use character conversion library.

Thanks! That did the trick.

Wolf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top