Setlocale and wchar_t C functions...
Kralidis,Tom [Burlington]
Tom.Kralidis at EC.GC.CA
Fri Jun 22 12:48:59 EDT 2007
FYI msGetLanguage can probably leverage MAP/LOCALE as well.
..Tom
> -----Original Message-----
> From: UMN MapServer Developers List
> [mailto:MAPSERVER-DEV at LISTS.UMN.EDU] On Behalf Of Steve Lime
> Sent: 22 June, 2007 12:39 PM
> To: MAPSERVER-DEV at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-DEV] Setlocale and wchar_t C functions...
>
> Great, thanks for the clarification.
>
> Steve
>
> >>> On 6/22/2007 at 10:55 AM, in message
> <75b4b93e0706220855k7b2d7797gb608527da8a11d0d at mail.gmail.com>,
> "Umberto Nicoletti" <umberto.nicoletti at gmail.com> wrote:
> > On 6/22/07, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
> >> Hi all: I'm working to resolve bug 1921 with deals with
> curved labels
> >> and
> > multibyte character sets. The current label path
> >> code doesn't handle multibyte character sets. Fortunately
> standard C
> >> (on
> > Linux and MacOS anyway) have some functions
> >> to deal with the problem. For example mbstowcs converts from a
> >> multibyte
> > string to a wide character string. The behavior
> >> of those functions depend on the locale. Unless you are in a local
> >> with
> > multibyte characters those functions don't work
> >> with multibyte chars and assume single byte chars. Found that out
> >> trying to
> > draw Chinese characters with the default US-EN
> >> locale. If I set the local to one with multibyte characters then I
> >> could
> > debug.
> >>
> >> A couple of questions then:
> >>
> >> - what would folks think about adding a LOCALE parameter to the
> >> main
> > mapObj? We could to a setlocale(LC_ALL, msyytext)
> >> immediately. If not set, then whatever the system has set
> takes over.
> >>
> >> - as I understand it setlocale has a global effect so
> perhaps there
> >> might
> > be some down stream side effects, although I can't
> >> think what they might be. I suppose for long running
> processes there
> >> could
> > be issues. I can see where a company might want
> >> to provide maps in different languages from the same server.
> >
> > Steve,
> > calling setlocale from mapserver will also change the locale of the
> > mapscript language which means, for Java, a global change of the
> > locale behaviour in the application server which is, I
> believe, not a
> > really good idea. The same happens with python, c#, etc and PHP
> > mapscript loaded as shared module will change the locale of apache.
> > I also seem to remember that calls to setlocale are not thread safe.
> >
> > A similar question was raised some time ago and at that time it was
> > somehow decided not to call setlocale from within mapserver.
> > See the thread titled: 'Proposing to call setlocale(
> LC_ALL, "C" ) in
> > msSetup()'
> >
> > To set the locale for a process one should use the usual
> environment
> > variables (LANG or LC_ALL). In particular it is possible to
> do this on
> > a per-map basis for the CGI version of mapserver either
> from whithin
> > apache or with a wrapper shell script.
> >
> > Regards,
> > Umberto
> >
> >
> >>
> >> - are the wide character functions (stdlib.h) available
> on all platforms?
> >>
> >> Steve
> >>
>
More information about the mapserver-dev
mailing list