︙ | | |
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
+
+
|
- (const char*)OF_cStringWithEncoding: (of_string_encoding_t)encoding
lossy: (bool)lossy;
- (OFString*)OF_JSONRepresentationWithOptions: (int)options
depth: (size_t)depth;
@end
extern bool of_unicode_to_iso_8859_2(const of_unichar_t*, unsigned char*,
size_t, bool);
extern bool of_unicode_to_iso_8859_3(const of_unichar_t*, unsigned char*,
size_t, bool);
extern bool of_unicode_to_iso_8859_15(const of_unichar_t*, unsigned char*,
size_t, bool);
extern bool of_unicode_to_windows_1251(const of_unichar_t*, unsigned char*,
size_t, bool);
extern bool of_unicode_to_windows_1252(const of_unichar_t*, unsigned char*,
size_t, bool);
|
︙ | | |
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
+
+
+
|
encoding = OF_STRING_ENCODING_ASCII;
else if ([string isEqual: @"iso-8859-1"] ||
[string isEqual: @"iso_8859-1"])
encoding = OF_STRING_ENCODING_ISO_8859_1;
else if ([string isEqual: @"iso-8859-2"] ||
[string isEqual: @"iso_8859-2"])
encoding = OF_STRING_ENCODING_ISO_8859_2;
else if ([string isEqual: @"iso-8859-3"] ||
[string isEqual: @"iso_8859-3"])
encoding = OF_STRING_ENCODING_ISO_8859_3;
else if ([string isEqual: @"iso-8859-15"] ||
[string isEqual: @"iso_8859-15"])
encoding = OF_STRING_ENCODING_ISO_8859_15;
else if ([string isEqual: @"windows-1251"] ||
[string isEqual: @"cp1251"] || [string isEqual: @"cp-1251"] ||
[string isEqual: @"1251"])
encoding = OF_STRING_ENCODING_WINDOWS_1251;
|
︙ | | |
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
|
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
|
+
+
+
+
+
+
+
+
+
+
+
+
+
|
if (!of_unicode_to_iso_8859_2(characters,
(unsigned char*)cString, length, lossy))
@throw [OFInvalidEncodingException exception];
cString[length] = '\0';
return length;
#endif
#ifdef HAVE_ISO_8859_3
case OF_STRING_ENCODING_ISO_8859_3:
if (length + 1 > maxLength)
@throw [OFOutOfRangeException exception];
if (!of_unicode_to_iso_8859_3(characters,
(unsigned char*)cString, length, lossy))
@throw [OFInvalidEncodingException exception];
cString[length] = '\0';
return length;
#endif
#ifdef HAVE_ISO_8859_15
case OF_STRING_ENCODING_ISO_8859_15:
if (length + 1 > maxLength)
@throw [OFOutOfRangeException exception];
|
︙ | | |
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
|
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
|
+
|
/* We don't care, as we only tried to make it smaller */
}
break;
case OF_STRING_ENCODING_ASCII:
case OF_STRING_ENCODING_ISO_8859_1:
case OF_STRING_ENCODING_ISO_8859_2:
case OF_STRING_ENCODING_ISO_8859_3:
case OF_STRING_ENCODING_ISO_8859_15:
case OF_STRING_ENCODING_WINDOWS_1251:
case OF_STRING_ENCODING_WINDOWS_1252:
case OF_STRING_ENCODING_CODEPAGE_437:
case OF_STRING_ENCODING_CODEPAGE_850:
case OF_STRING_ENCODING_CODEPAGE_858:
case OF_STRING_ENCODING_MAC_ROMAN:
|
︙ | | |
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
|
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
|
+
|
UTF8StringLength += len;
}
return UTF8StringLength;
case OF_STRING_ENCODING_ASCII:
case OF_STRING_ENCODING_ISO_8859_1:
case OF_STRING_ENCODING_ISO_8859_2:
case OF_STRING_ENCODING_ISO_8859_3:
case OF_STRING_ENCODING_ISO_8859_15:
case OF_STRING_ENCODING_WINDOWS_1251:
case OF_STRING_ENCODING_WINDOWS_1252:
case OF_STRING_ENCODING_CODEPAGE_437:
case OF_STRING_ENCODING_CODEPAGE_850:
case OF_STRING_ENCODING_CODEPAGE_858:
case OF_STRING_ENCODING_MAC_ROMAN:
|
︙ | | |