Internationalization patch, i18n, iconv, ...

Joe Little jlittle at open-it.org
Wed Oct 17 07:44:29 CEST 2001


well, mac is now UNIX, its also already I18N natively

Don't start a flame war without fuel :)....

I'm merely stating the the python-ldap module needs to maintain its 
ability to be os agnostic.

On Tuesday, October 16, 2001, at 10:18 PM, js9s at netscape.net wrote:

> UNIX(LINUX)  is the only OS I know that has the internationalization 
> (i18n) concept. Windows, VMS and many other less known OS, such as 
> milkyway etc., only have the concept of localization (L10?).  This 
> patch may be used for localization purpose as well, but its main target 
> is the i18n type of applications.  Don't know about mac, but since it 
> is mainly a personal system, my guess is that it is just like windows, 
> L10 only.
>
> any way, I appreciate the good work in the free software community, and 
> like to contribute something back.  I have no interest getting into the 
> OS squabbling, especially with mac fans.
>
> Thanks
> J.
>
>
> jmlittle at mac.com wrote:
>
>> I wouldn't suggest that the audience here is 100% linux. Rather, a
>> majority likely is not
>>
>> On Tuesday, October 16, 2001, at 10:41 AM, js9s at netscape.net wrote:
>>
>>> The iconv is part of glibc 2.2.2 and above, so iconv.h should be in 
>>> any
>>> recent LINUX system if the C developement environment is configured. 
>>> If
>>> older than glic 2.2.2, you might have to install the iconvlib
>>> seperately.
>>>
>>> I did try to use PyString_(De/En)code, but it is not very well suited
>>> to openldap type of applications, especially if dn has mixed ascii and
>>> utf8 encodings.  But I will be happy if someone can prove I am wrong.
>>>
>>> Thanks.
>>> J.
>>>
>>>
>>> David Leonard <david.leonard at itee.uq.edu.au> wrote:
>>>
>>>>
>>>> On Sat, 13 Oct 2001, js9s at netscape.net typed thusly:
>>>>> I just worked out the python-ldap so that it will convert the
>>>>> local charactors to utf8 or vice versa according to the user locale
>>>>> setup.   This is done because OpenLdap currently only support utf8,
>>>>> so  one has to make the  translation.   I tested on zh_CN.GB2312
>>>>> (simplified Chinese), and it worked.  By no means it is a complete
>>>>> test, but it is a good start, and it worked for me.  The patch was
>>>>> generated against the CVS tree check out yesterday, so it is pretty
>>>>> recent.
>>>>> Here is the patch in the attachment.
>>>>
>>>> hi
>>>>
>>>> sorry i have been unable to respond to you - i had marked your
>>>> message important but have been busy of late. :(
>>>>
>>>> i'm glad you send it to the list, because it will stand a better 
>>>> chance
>>>> of being reviewed there.. a better chance than just sitting in my
>>>> mailbox.
>>>>
>>>> here are my comments from a quick perusal of the diff
>>>>
>>>> ... the diff is reversed. (took me a moment to figure out what was
>>>> going on there!.. the order is 'diff <old> <new>')
>>>>
>>>> ... you're relying on an iconv.h header file, which isn't on every
>>>> system. (especially mine)
>>>>
>>>> .. I think instead to use PyString_Decode() and PyString_Encode()..
>>>> that way you get python unicode string objects.
>>>>
>>>> i'm not an expert on these things, but here is a cut and paste from
>>>> a python header file:
>>>>
>>>> /* Create a string object by decoding the encoded string s of the
>>>>   given size. */
>>>>
>>>> extern DL_IMPORT(PyObject*) PyString_Decode(
>>>>    const char *s,              /* encoded string */
>>>>    int size,                   /* size of buffer */
>>>>    const char *encoding,       /* encoding */
>>>>    const char *errors          /* error handling */
>>>>    );
>>>>
>>>> /* Encodes a char buffer of the given size and returns a
>>>>   Python string object. */
>>>>
>>>> extern DL_IMPORT(PyObject*) PyString_Encode(
>>>>    const char *s,              /* string char buffer */
>>>>    int size,                   /* number of chars to encode */
>>>>    const char *encoding,       /* encoding */
>>>>    const char *errors          /* error handling */
>>>>    );
>>>>
>>>>
>>>> d
>>>>
>>>> --
>>>> David Leonard                           David.Leonard at itee.uq.edu.au
>>>> Dept of Inf. Tech. and Elec. Engg   _   Ph:+61 404 844 850
>>>> The University of Queensland       |+|
>>>> http://www.itee.uq.edu.au/~leonard/
>>>> QLD 4072  AUSTRALIA               ~` '~
>>>> B73CD65FBEF4C089B79A8EBADF1A932F13EA0FC8
>>>>
>>>> Make sure that you have enough free memory in your temp directory.
>>>>    - Sun StarOffice README
>>>>
>>>>
>>>>
>>>
>>>
>>> 


More information about the python-ldap mailing list