[PyObjC-svn] r2594 - trunk/pyobjc/pyobjc-core/Modules/objc
[email protected] Tue, 28 Sep 2010 02:20:06 -0500
| Newsgroups | gmane.comp.python.pyobjc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: ronaldoussoren
Date: Tue Sep 28 02:20:06 2010
New Revision: 2594
Log:
Fix for issue #3077003 on SF.net: calculating the Cocoa string encoding
from the Python one used strcmp in a bad way.
Issue reported by Ken Thomases
Modified:
trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonString.m
Modified: trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonString.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonString.m (original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonString.m Tue Sep 28 02:20:06 2010
@@ -71,13 +71,13 @@
*/
NSStringEncoding encoding = [NSString defaultCStringEncoding];
const char* pycoding = PyUnicode_GetDefaultEncoding();
- if (strcmp(pycoding, "ascii")) {
+ if (strcmp(pycoding, "ascii") == 0) {
encoding = NSASCIIStringEncoding;
- } else if (strcmp(pycoding, "utf-8")) {
+ } else if (strcmp(pycoding, "utf-8") == 0) {
encoding = NSUTF8StringEncoding;
- } else if (strcmp(pycoding, "latin1")) {
+ } else if (strcmp(pycoding, "latin1") == 0) {
encoding = NSISOLatin1StringEncoding;
- } else if (strcmp(pycoding, "macroman")) {
+ } else if (strcmp(pycoding, "macroman") == 0) {
encoding = NSMacOSRomanStringEncoding;
} else {
/* A very non-standard system encoding, use
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev