summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2003-02-21 18:18:49 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2003-02-21 18:18:49 (GMT)
commite9b851a5e9a35714e786d7ad72fde50e9d4c0a29 (patch)
tree7a959fba0a0736b755148e58527e2b20cb5c488d
parent14821c59147228d45e3b6f828e7188a4075fa9cb (diff)
downloadcpython-e9b851a5e9a35714e786d7ad72fde50e9d4c0a29.zip
cpython-e9b851a5e9a35714e786d7ad72fde50e9d4c0a29.tar.gz
cpython-e9b851a5e9a35714e786d7ad72fde50e9d4c0a29.tar.bz2
Use 'ISO8859-1' instead of 'ASCII' when testing whether byteswapping
is required for the chosen internal encoding in the init function, as this seems to have a better chance of working under Irix and Solaris. Also change the test character from '\x01' to '0'. This might fix SF bug #690309.
-rw-r--r--Modules/_iconv_codec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_iconv_codec.c b/Modules/_iconv_codec.c
index ffae455..1d2e5d4 100644
--- a/Modules/_iconv_codec.c
+++ b/Modules/_iconv_codec.c
@@ -663,7 +663,7 @@ init_iconv_codec(void)
{
PyObject *m;
- char in = 1;
+ char in = '0';
char *inptr = &in;
size_t insize = 1;
Py_UNICODE out = 0;
@@ -671,7 +671,7 @@ init_iconv_codec(void)
size_t outsize = sizeof(out);
size_t res;
- iconv_t hdl = iconv_open(UNICODE_ENCODING, "ASCII");
+ iconv_t hdl = iconv_open(UNICODE_ENCODING, "ISO8859-1");
if (hdl == (iconv_t)-1) {
PyErr_SetString(PyExc_RuntimeError,
@@ -688,12 +688,12 @@ init_iconv_codec(void)
/* Check whether conv() returned native endianess or not for the chosen
encoding */
- if (out == 0x1)
+ if (out == 0x30)
byteswap = 0;
#if Py_UNICODE_SIZE == 2
- else if (out == 0x0100)
+ else if (out == 0x3000)
#else
- else if (out == 0x01000000)
+ else if (out == 0x30000000)
#endif
byteswap = 1;
else {