guile-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] fix locale string reading


From: Nala Ginrut
Subject: Re: [PATCH] fix locale string reading
Date: Wed, 9 Nov 2011 12:10:12 +0800

Well, I've read the manual about scm_*_locale_string. 
It shows:
-----------------------------------
Note that these functions should not be used to convert C string constants, because
there is no guarantee that the current locale will match that of the source code. To
convert C string constants, use scm_from_latin1_string, scm_from_utf8_string
or scm_from_utf32_string.
------------------------------------

I think there's in a dilemma. According to the manual, we should convert string or change locale in the users' code.
But Guile will break in (command-line) proc, because Chinese string as command arguments can not get valid result from  "u32_conv_from_encoding" called by "scm_from_stringn", and raised an error. 
So we don't have any chance to convert it or change locale from environment in the users' code because Guile has already crashed by "decoding-error".

Now I have two questons:
1. Maybe we raised this "decoding-error" too early. Can we let "scm_from_locale_stringn" just return the string which wasn't recognized as a bytevector? Then we may convert it as wish. But it's confused for "scm_from_locale_stringn" returning a bytevector;
2. Why not let "scm_from_locale_stringn" return string according to the locale from current environment as my patch?


reply via email to

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