pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Character encoding again.


From: Ben Pfaff
Subject: Re: Character encoding again.
Date: Sun, 14 Nov 2010 20:38:07 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

John Darrington <address@hidden> writes:

> On Thu, Nov 04, 2010 at 10:12:15PM -0700, Ben Pfaff wrote:
>      John Darrington <address@hidden> writes:
>      
>      > Has anyone got any sensible suggestions on how to implement the two 
> functions:
>      >
>      >  int get_codepage_from_encoding_name (const char*);  and
>      >  const char *get_encoding_from_codepage (int);
>      
>      I'm appending an implementation.  What do you think?
>
> The implementation per se looks good except that the 
> extern declarations in sys-file-private.h should go
> in sys-file-private.c I think.

Those declarations have definitions in sys-file-encoding.c and
users in sys-file-private.c.  sys-file-private.h is included by
both of those files, so if I screw up the uses in
sys-file-private.c or the definitions in sys-file-encoding.c,
then it will provoke a warning.  But if I move the extern
declaration from sys-file-private.h into sys-file-private.c, then
it will cause segmentation faults (etc.) at runtime without any
compiler warnings.  So I'd prefer to keep them in the header
file.

If I check in this code, will it help you?  I'm happy to do so.

>      (It occurs to me that I might have the wrong idea for
>      sys_get_encoding_from_codepage().  Maybe it should return a name
>      for the encoding *on the local machine*, not on Windows.  Or
>      maybe we need both functions.)
>
> Perhaps you're right.   When writing a sysfile, the encoding must be
> one that will be recognised by SPSS (that means Windows).  When reading
> a sysfile, it should be one that is recognised by the local machine (in
> other words by the installed iconv implementation).

OK.  I'll work on that, then.

> Out of the 322 encodings in the table, only 138 are recognised by the iconv
> on my machine.   We can't possible know in advance which encodings will be
> recognised.  Even if we could, we couldn't be sure that every 2-permutation
> of them will be convertable.    So the fallback problem remains.

I don't have a good solution for that problem.  I can't remember
what you suggested before.
-- 
Ben Pfaff 
http://benpfaff.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]