mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
add some more cset encoding support
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23989 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
55c596a150
commit
c22b722f1f
6 changed files with 76 additions and 9 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2006-10-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSPrivate.h:
|
||||
* Source/Additions/Unicode.m:
|
||||
* Source/GSeq.h:
|
||||
* Headers/Additions/GNUstepBase/Unicode.h:
|
||||
uni_cop should be private in future.
|
||||
* Source/Additions/GSMime.m: Add support for some more character
|
||||
encodings.
|
||||
|
||||
2006-10-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSTask.m: GSPrivateCheckTasks() retain terminated task
|
||||
|
|
|
@ -49,12 +49,15 @@ extern "C" {
|
|||
/* Deprecated functions */
|
||||
GS_EXPORT NSStringEncoding GSEncodingFromLocale(const char *clocale);
|
||||
GS_EXPORT NSStringEncoding GSEncodingForRegistry(NSString *registry,
|
||||
NSString *encoding);
|
||||
NSString *encoding);
|
||||
GS_EXPORT unichar uni_tolower(unichar ch);
|
||||
GS_EXPORT unichar uni_toupper(unichar ch);
|
||||
|
||||
GS_EXPORT unsigned char uni_cop(unichar u);
|
||||
GS_EXPORT BOOL uni_isnonsp(unichar u);
|
||||
GS_EXPORT unichar *uni_is_decomp(unichar u);
|
||||
GS_EXPORT unsigned GSUnicode(const unichar *chars, unsigned length,
|
||||
BOOL *isASCII, BOOL *isLatin1);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -67,8 +70,6 @@ GS_EXPORT unichar *uni_is_decomp(unichar u);
|
|||
#define GSUniBOM 0x08
|
||||
#define GSUniShortOk 0x10
|
||||
|
||||
GS_EXPORT unsigned GSUnicode(const unichar *chars, unsigned length,
|
||||
BOOL *isASCII, BOOL *isLatin1);
|
||||
GS_EXPORT BOOL GSFromUnicode(unsigned char **dst, unsigned int *size,
|
||||
const unichar *src, unsigned int slen, NSStringEncoding enc, NSZone *zone,
|
||||
unsigned int options);
|
||||
|
|
|
@ -3604,8 +3604,9 @@ static NSCharacterSet *tokenSet = nil;
|
|||
NSIntMapValueCallBacks, 0);
|
||||
|
||||
/*
|
||||
* These mappings were obtained from
|
||||
* These mappings were obtained primarily from
|
||||
* http://www.iana.org/assignments/character-sets
|
||||
* with additions determined empirically.
|
||||
*
|
||||
* We should ideally have all the aliases for each
|
||||
* encoding we support, but I just did the aliases
|
||||
|
@ -3623,6 +3624,8 @@ static NSCharacterSet *tokenSet = nil;
|
|||
(void*)NSASCIIStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso_646.irv:1991",
|
||||
(void*)NSASCIIStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso_646.991-irv",
|
||||
(void*)NSASCIIStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"ascii",
|
||||
(void*)NSASCIIStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso646-us",
|
||||
|
@ -3682,34 +3685,64 @@ static NSCharacterSet *tokenSet = nil;
|
|||
(void*)NSISOLatin5StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso-8859-10",
|
||||
(void*)NSISOLatin6StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso-8859-11",
|
||||
(void*)NSISOThaiStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso-8859-13",
|
||||
(void*)NSISOLatin7StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso-8859-14",
|
||||
(void*)NSISOLatin8StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso-8859-15",
|
||||
(void*)NSISOLatin9StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"microsoft-symbol",
|
||||
(void*)NSSymbolStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"windows-symbol",
|
||||
(void*)NSSymbolStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"microsoft-cp1250",
|
||||
(void*)NSWindowsCP1250StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"windows-1250",
|
||||
(void*)NSWindowsCP1250StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"microsoft-cp1251",
|
||||
(void*)NSWindowsCP1251StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"windows-1251",
|
||||
(void*)NSWindowsCP1251StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"microsoft-cp1252",
|
||||
(void*)NSWindowsCP1252StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"windows-1252",
|
||||
(void*)NSWindowsCP1252StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"microsoft-cp1253",
|
||||
(void*)NSWindowsCP1253StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"windows-1253",
|
||||
(void*)NSWindowsCP1253StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"microsoft-cp1254",
|
||||
(void*)NSWindowsCP1254StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"windows-1254",
|
||||
(void*)NSWindowsCP1254StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso-10646-ucs-2",
|
||||
(void*)NSUnicodeStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"utf-16",
|
||||
(void*)NSUnicodeStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"iso10646-1",
|
||||
(void*)NSUnicodeStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"big5",
|
||||
(void*)NSBIG5StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"jisx0201.1976",
|
||||
(void*)NSShiftJISStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"shift_JIS",
|
||||
(void*)NSShiftJISStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"utf-7",
|
||||
(void*)NSUTF7StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"utf-8",
|
||||
(void*)NSUTF8StringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"apple-roman",
|
||||
(void*)NSMacOSRomanStringEncoding);
|
||||
NSMapInsert(charsets, (void*)@"koi8-r",
|
||||
(void*)NSKOI8RStringEncoding);
|
||||
NSMapInsert(encodings, (void*)@"gb2312.1980",
|
||||
(void*)NSGB2312StringEncoding);
|
||||
NSMapInsert(encodings, (void*)@"ksc5601.1987",
|
||||
(void*)NSKoreanEUCStringEncoding);
|
||||
NSMapInsert(encodings, (void*)@"ksc5601.1997",
|
||||
(void*)NSKoreanEUCStringEncoding);
|
||||
}
|
||||
if (encodings == 0)
|
||||
{
|
||||
|
@ -3747,6 +3780,8 @@ static NSCharacterSet *tokenSet = nil;
|
|||
(void*)@"iso-8859-9");
|
||||
NSMapInsert(encodings, (void*)NSISOLatin6StringEncoding,
|
||||
(void*)@"iso-8859-10");
|
||||
NSMapInsert(encodings, (void*)NSISOThaiStringEncoding,
|
||||
(void*)@"iso-8859-11");
|
||||
NSMapInsert(encodings, (void*)NSISOLatin7StringEncoding,
|
||||
(void*)@"iso-8859-13");
|
||||
NSMapInsert(encodings, (void*)NSISOLatin8StringEncoding,
|
||||
|
@ -3775,6 +3810,14 @@ static NSCharacterSet *tokenSet = nil;
|
|||
(void*)@"utf-8");
|
||||
NSMapInsert(encodings, (void*)NSGSM0338StringEncoding,
|
||||
(void*)@"gsm0338");
|
||||
NSMapInsert(encodings, (void*)NSMacOSRomanStringEncoding,
|
||||
(void*)@"apple-roman");
|
||||
NSMapInsert(encodings, (void*)NSKOI8RStringEncoding,
|
||||
(void*)@"koi8-r");
|
||||
NSMapInsert(encodings, (void*)NSGB2312StringEncoding,
|
||||
(void*)@"gb2312.1980");
|
||||
NSMapInsert(encodings, (void*)NSKoreanEUCStringEncoding,
|
||||
(void*)@"ksc5601.1987");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -613,7 +613,7 @@ uni_toupper(unichar ch)
|
|||
}
|
||||
|
||||
unsigned char
|
||||
uni_cop(unichar u)
|
||||
GSPrivateUniCop(unichar u)
|
||||
{
|
||||
if (u < uni_cop_table[0].code)
|
||||
{
|
||||
|
@ -658,6 +658,12 @@ uni_cop(unichar u)
|
|||
}
|
||||
}
|
||||
|
||||
unsigned char
|
||||
uni_cop(unichar u)
|
||||
{
|
||||
return GSPrivateUniCop(u);
|
||||
}
|
||||
|
||||
BOOL
|
||||
uni_isnonsp(unichar u)
|
||||
{
|
||||
|
@ -669,7 +675,7 @@ uni_isnonsp(unichar u)
|
|||
return YES;
|
||||
|
||||
// FIXME check is uni_cop good for this
|
||||
if (uni_cop(u))
|
||||
if (GSPrivateUniCop(u))
|
||||
return YES;
|
||||
else
|
||||
return NO;
|
||||
|
|
|
@ -431,6 +431,11 @@ GSPrivateStrExternalize(GSStr s) GS_ATTRIB_PRIVATE;
|
|||
NSString *
|
||||
GSPrivateSymbolPath (Class theClass, Category *theCategory) GS_ATTRIB_PRIVATE;
|
||||
|
||||
/* Combining class for composite unichars
|
||||
*/
|
||||
unsigned char
|
||||
GSPrivateUniCop(unichar u) GS_ATTRIB_PRIVATE;
|
||||
|
||||
/* unload a module from the runtime (not implemented)
|
||||
*/
|
||||
long
|
||||
|
|
|
@ -167,9 +167,10 @@ static inline void GSeq_normalize(GSeq seq)
|
|||
notdone = NO;
|
||||
for (i = 1; i < count; i++)
|
||||
{
|
||||
if (uni_cop(*second))
|
||||
if (GSPrivateUniCop(*second))
|
||||
{
|
||||
if (uni_cop(*first) > uni_cop(*second))
|
||||
if (GSPrivateUniCop(*first)
|
||||
> GSPrivateUniCop(*second))
|
||||
{
|
||||
unichar tmp = *first;
|
||||
|
||||
|
@ -177,7 +178,8 @@ static inline void GSeq_normalize(GSeq seq)
|
|||
*second = tmp;
|
||||
notdone = YES;
|
||||
}
|
||||
else if (uni_cop(*first) == uni_cop(*second))
|
||||
else if (GSPrivateUniCop(*first)
|
||||
== GSPrivateUniCop(*second))
|
||||
{
|
||||
if (*first > *second)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue