This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: charset for a locale


andrew@pimlott.ne.mediaone.net (Andrew Pimlott) writes:

> I hope this is an ok place to ask this question.
> 
> I have read the glibc 2.2 documentation on charset handling and
> locales, and a very basic concept still escapes me.  How can I
> figure out the default multibyte encoding for the current locale
> (ie, the encoding used to interpret the char type)?  It seems that I
> can use the mbtowc functions to convert any string to Unicode (well,
> this assumes I know the wchar encoding, but in practice this is
> easier), but can't actually query the multibyte encoding used by
> mbtowc.  This would seem further to imply that mbtowc has
> functionality that cannot be obtained with the iconv functions,
> which I find strange.
> 
> Did I miss something?  Is there a reason that most people don't need
> this functionality?

#include <langinfo.h>

...
prinf ("%s\n", nl_langinfo(CODESET));
...

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]