[Python-checkins] python/dist/src/Python mactoolboxglue.c,1.13,1.14
loewis@users.sourceforge.net
loewis@users.sourceforge.net
Tue, 26 Nov 2002 01:05:38 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv20873/Python
Modified Files:
mactoolboxglue.c
Log Message:
Patch #632973: Implement _getdefaultlocale for OS X.
Index: mactoolboxglue.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** mactoolboxglue.c 9 Nov 2002 14:47:18 -0000 1.13
--- mactoolboxglue.c 26 Nov 2002 09:05:36 -0000 1.14
***************
*** 39,47 ****
{
#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";
#else
int font, script, lang;
--- 39,58 ----
{
#if TARGET_API_MAC_OSX
! 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;