473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

std::strerror and UTF-8

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

Jul 3 '06 #1
3 1860
On 3 Jul 2006 09:01:49 -0700, "Wolfgang Meier" <wo***@sofort-mail.de>
wrote:
>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
Jul 3 '06 #2
Wolfgang Meier wrote:
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.

Jul 4 '06 #3
An**********@gmail.com wrote:
Wolfgang Meier wrote:
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?
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

Jul 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: vsgdp | last post by:
Hi, Is there a unicode equivalent to std::string?
32
by: Wolfgang Draxinger | last post by:
I understand that it is perfectly possible to store UTF-8 strings in a std::string, however doing so can cause some implicaions. E.g. you can't count the amount of characters by length() | size()....
8
by: davihigh | last post by:
My Friends: I am using std::ofstream (as well as ifstream), I hope that when i wrote in some std::string(...) with locale, ofstream can convert to UTF-8 encoding and save file to disk. So does...
12
by: Rafał Maj Raf256 | last post by:
Hi, I have an UNICODE text file endcoded in UTF-8. I should store the UNICODE strings in my program for example in std::wstring right? To be able to work on them normally, so that std::wstring...
23
by: Steven T. Hatton | last post by:
This is one of the first obstacles I encountered when getting started with C++. I found that everybody had their own idea of what a string is. There was std::string, QString, xercesc::XMLString,...
8
by: Divick | last post by:
Hi all, can somebody tell how much std::wstring is supported across different compilers on different platforms? AFAIK std::string is supported by almost all C++ compilers and almost all platforms,...
7
by: Jimmy Shaw | last post by:
Hi everybody, Is there any SIMPLE way to convert from UTF-16 to UTF-32? I may be mixed up, but is it possible that all UTF-16 "code points" that are 16 bits long appear just the same in UTF-32,...
14
by: rohitpatel9999 | last post by:
Hi While developing any software, developer need to think about it's possible enhancement for international usage and considering UNICODE. I have read many nice articles/items in advanced C++...
4
by: =?ISO-8859-2?Q?Boris_Du=B9ek?= | last post by:
Hi, I have an API that returns UTF-8 encoded strings. I have a utf8 codevt facet available to do the conversion from UTF-8 to wchar_t encoding defined by the platform. I have no trouble...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.