]> granicus.if.org Git - python/commitdiff
Mod to previous checkin: we must require ascii, not system defautl encoding,
authorJack Jansen <jack.jansen@cwi.nl>
Mon, 3 Mar 2003 13:19:44 +0000 (13:19 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Mon, 3 Mar 2003 13:19:44 +0000 (13:19 +0000)
because we have no easy way to convert the python encoding string to
a CF encoding parameter.

Mac/Modules/cf/cfsupport.py
Mac/Modules/cf/pycfbridge.c

index bb0ac40483f0c00ec408eb4b1753eb4d10846d20..e8fb710310ec9a4446d6543f572a5d31621efd33 100644 (file)
@@ -360,7 +360,7 @@ class CFStringRefObjectDefinition(MyGlobalObjectDefinition):
                if (v == Py_None) { *p_itself = NULL; return 1; }
                if (PyString_Check(v)) {
                    char *cStr;
-                   if (!PyArg_Parse(v, "et", "ascii", &cStr))
+                   if (!PyArg_Parse(v, "es", "ascii", &cStr))
                        return NULL;
                        *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
                        return 1;
index d4466aca108c61890b1acfe278424f3daa0bbc68..21a952262c4be8cc83b61dda1093b12830264901 100644 (file)
@@ -292,7 +292,7 @@ PyCF_Python2CF_string(PyObject *src, CFStringRef *dst) {
        UniChar *unichars;
        
        if (PyString_Check(src)) {
-               if (!PyArg_Parse(src, "es", NULL, &chars))
+               if (!PyArg_Parse(src, "es", "ascii", &chars))
                        return NULL; /* This error is more descriptive than the general one below */
                *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII);
                return 1;