mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-07 15:01:10 +00:00
Simplify automatic charset selection for performance.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20942 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bc1aa70ed4
commit
d8337a42c7
1 changed files with 8 additions and 1 deletions
|
@ -258,6 +258,13 @@ selectCharacterSet(NSString *str, NSData **d)
|
|||
return @"us-ascii"; // Default character set.
|
||||
if ((*d = [str dataUsingEncoding: NSISOLatin1StringEncoding]) != nil)
|
||||
return @"iso-8859-1";
|
||||
|
||||
/*
|
||||
* What's the point of trying loads of charactersets ... utf-8 is
|
||||
* well-known nowadays, so if we can't use ascii or latin1 we may
|
||||
* as well go straight to utf-8
|
||||
*/
|
||||
#if 0
|
||||
if ((*d = [str dataUsingEncoding: NSISOLatin2StringEncoding]) != nil)
|
||||
return @"iso-8859-2";
|
||||
if ((*d = [str dataUsingEncoding: NSISOLatin3StringEncoding]) != nil)
|
||||
|
@ -292,7 +299,7 @@ selectCharacterSet(NSString *str, NSData **d)
|
|||
return @"windows-1253";
|
||||
if ((*d = [str dataUsingEncoding: NSWindowsCP1254StringEncoding]) != nil)
|
||||
return @"windows-1254";
|
||||
|
||||
#endif
|
||||
*d = [str dataUsingEncoding: NSUTF8StringEncoding];
|
||||
return @"utf-8"; // Catch-all character set.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue