harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Lee <littlee1...@gmail.com>
Subject Re: Shall we change our file.encoding
Date Fri, 17 Jul 2009 13:44:56 GMT
Thanks Alexey!  Also will try this :-)

On Fri, Jul 17, 2009 at 7:03 PM, Alexey Varlamov <
alexey.v.varlamov@gmail.com> wrote:

> 2009/7/17, Nathan Beyer <ndbeyer@apache.org>:
> > On Thu, Jul 16, 2009 at 8:50 PM, Nathan Beyer<ndbeyer@apache.org> wrote:
> > > On Thu, Jul 16, 2009 at 8:35 PM, Nathan Beyer<ndbeyer@apache.org>
> wrote:
> > >> On Thu, Jul 16, 2009 at 8:26 PM, Nathan Beyer<ndbeyer@apache.org>
> wrote:
> > >>> On Thu, Jul 16, 2009 at 8:18 PM, Charles Lee<littlee1032@gmail.com>
> wrote:
> > >>>> Hi Nathan,
> > >>>>
> > >>>> What I got is 936, the code page identifier. Is there a api for
us
> to map
> > >>>> 936 to the gb2312?
> > >>>
> > >>> Oh, the 'identifier' bit was missing - yeah, we'll need to translate
> > >>> that into a name of some sort. I'll poke around a bit and see what
I
> > >>> can find.
> > >>
> > >> We'll probably just have to put in a mapping ourselves based on the
> > >> documentation. We'd call GetACP [1] and map that to a known alias in
> > >> java.nio.charset that matches the definitions[2] of the identifiers.
> > >>
> > >> [1] http://msdn.microsoft.com/en-us/library/dd318070%28VS.85%29.aspx
> > >> [2] http://msdn.microsoft.com/en-us/library/dd317756%28VS.85%29.aspx
> > >
> > > This may be better - APR has a function for getting the OS default
> > > encoding. This would work across all platforms that APR supports and I
> > > believe we already use APR.
> > >
> > >
> http://apr.apache.org/docs/apr/1.3/group__apr__portabile.html#g6e21845a4a5f3b7dd107b2beea50c91e
> >
> > However, the Windows version of this is simply - return
> > apr_psprintf(pool, "CP%u", (unsigned) GetACP());. Which is essentially
> > "CP" + codePageId.
> >
> > And the Unix version of this method doesn't look very good for our
> purposes.
> > >
> > > -Nathan
>
> Yep - that's why APR was not used here initially. I guess your idea of
> GetACP() + hardcoded mapping is the most suitable approach. We already
> have similar solution for timezone detection, see
> working_vm\vm\port\src\misc\win\timezone.c (which also should be moved
> to classlib eventually, HARMONY-2053).
>
> --
> Alexey
>



-- 
Yours sincerely,
Charles Lee

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message