? a.c ? encodings.txt Index: Modules/_localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.35 diff -u -r2.35 _localemodule.c --- Modules/_localemodule.c 2 Aug 2002 02:27:13 -0000 2.35 +++ Modules/_localemodule.c 3 Nov 2002 19:51:44 -0000 @@ -30,7 +30,7 @@ #include #endif -#ifdef macintosh +#if __APPLE__ #include "macglue.h" #endif @@ -400,7 +400,7 @@ } #endif -#if defined(macintosh) +#if defined(__APPLE__) static PyObject* PyLocale_getdefaultlocale(PyObject* self) { @@ -627,7 +627,7 @@ METH_VARARGS, strcoll__doc__}, {"strxfrm", (PyCFunction) PyLocale_strxfrm, METH_VARARGS, strxfrm__doc__}, -#if defined(MS_WINDOWS) || defined(macintosh) +#if defined(MS_WINDOWS) || defined(__APPLE__) {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, #endif #ifdef HAVE_LANGINFO_H Index: Python/mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.11 diff -u -r1.11 mactoolboxglue.c --- Python/mactoolboxglue.c 19 Oct 2002 22:02:21 -0000 1.11 +++ Python/mactoolboxglue.c 3 Nov 2002 19:51:46 -0000 @@ -38,11 +38,22 @@ char *PyMac_getscript() { #if TARGET_API_MAC_OSX - /* We cannot use GetSysFont because it requires the window manager - ** There are other APIs to query the default 8 bit encoding, but - ** I don't know about them (yet). - */ - return "ascii"; + CFStringEncoding enc = CFStringGetSystemEncoding(); + static CFStringRef name = NULL; + /* Return the code name for the encodings for which we have codecs. */ + switch(enc) { + case kCFStringEncodingMacRoman: return "mac-roman"; + case kCFStringEncodingMacGreek: return "mac-greek"; + case kCFStringEncodingMacCyrillic: return "mac-cyrillic"; + case kCFStringEncodingMacTurkish: return "mac-turkish"; + case kCFStringEncodingMacIcelandic: return "mac-icelandic"; + /* XXX which one is mac-latin2? */ + } + if (!name) { + /* This leaks a an object. */ + name = CFStringConvertEncodingToIANACharSetName(enc); + } + return CFStringGetCStringPtr(name, 0); #else int font, script, lang; font = 0; @@ -569,4 +580,4 @@ GLUE_CONVERT(CFURLRef, OptionalCFURLRefObj_Convert, "Carbon.CF") GLUE_NEW(CFURLRef, CFURLRefObj_New, "Carbon.CF") -#endif /* USE_TOOLBOX_OBJECT_GLUE */ \ No newline at end of file +#endif /* USE_TOOLBOX_OBJECT_GLUE */