Overview
Comment: | Add Windows-1251 encoding |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0f88ccfb04c05c84ea38f1c27e179195 |
User & Date: | js on 2017-01-11 04:22:31 |
Other Links: | manifest | tags |
Context
2017-01-11
| ||
04:33 | Reduce code duplication check-in: 44ea4f9322 user: js tags: trunk | |
04:22 | Add Windows-1251 encoding check-in: 0f88ccfb04 user: js tags: trunk | |
03:49 | Use U+FFFF for invalid characters check-in: a9f85ba3b1 user: js tags: trunk | |
Changes
Modified ObjFW.xcodeproj/project.pbxproj from [07fc46776a] to [52a6ce359d].
︙ | ︙ | |||
958 959 960 961 962 963 964 965 966 967 968 969 970 971 | 4BF33B0C133807A20059CEF7 /* OFThreadTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67B1235358D0076B512 /* OFThreadTests.m */; }; 4BF33B0D133807A20059CEF7 /* OFURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF0749512DFAFCA00A4ADD1 /* OFURLTests.m */; }; 4BF33B0E133807A20059CEF7 /* OFXMLElementBuilderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67C1235358D0076B512 /* OFXMLElementBuilderTests.m */; }; 4BF33B10133807A20059CEF7 /* OFXMLParserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67E1235358D0076B512 /* OFXMLParserTests.m */; }; 4BF33B12133807A20059CEF7 /* TestsAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF6811235358D0076B512 /* TestsAppDelegate.m */; }; 4BF33B4713380CE20059CEF7 /* testfile.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4313380CD40059CEF7 /* testfile.txt */; }; 4BF33B4813380D2D0059CEF7 /* testfile.bin in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4213380CD40059CEF7 /* testfile.bin */; }; 4BF48CE118A95F83000E8D04 /* OFBigDataArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF48CDF18A95F83000E8D04 /* OFBigDataArray.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BF48CE218A95F83000E8D04 /* OFBigDataArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF48CE018A95F83000E8D04 /* OFBigDataArray.m */; }; 4BF69CE61BD44F8B00DFFC1B /* platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF69CE51BD44F8B00DFFC1B /* platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BFF3714177E17C100192782 /* OFRemoveItemFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BFF3715177E17C100192782 /* OFRemoveItemFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */; }; /* End PBXBuildFile section */ | > > | 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | 4BF33B0C133807A20059CEF7 /* OFThreadTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67B1235358D0076B512 /* OFThreadTests.m */; }; 4BF33B0D133807A20059CEF7 /* OFURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF0749512DFAFCA00A4ADD1 /* OFURLTests.m */; }; 4BF33B0E133807A20059CEF7 /* OFXMLElementBuilderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67C1235358D0076B512 /* OFXMLElementBuilderTests.m */; }; 4BF33B10133807A20059CEF7 /* OFXMLParserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67E1235358D0076B512 /* OFXMLParserTests.m */; }; 4BF33B12133807A20059CEF7 /* TestsAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF6811235358D0076B512 /* TestsAppDelegate.m */; }; 4BF33B4713380CE20059CEF7 /* testfile.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4313380CD40059CEF7 /* testfile.txt */; }; 4BF33B4813380D2D0059CEF7 /* testfile.bin in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4213380CD40059CEF7 /* testfile.bin */; }; 4BF3A2291E25EA48002EA46F /* windows_1251.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3A2281E25EA48002EA46F /* windows_1251.m */; }; 4BF3A22A1E25EA48002EA46F /* windows_1251.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3A2281E25EA48002EA46F /* windows_1251.m */; }; 4BF48CE118A95F83000E8D04 /* OFBigDataArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF48CDF18A95F83000E8D04 /* OFBigDataArray.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BF48CE218A95F83000E8D04 /* OFBigDataArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF48CE018A95F83000E8D04 /* OFBigDataArray.m */; }; 4BF69CE61BD44F8B00DFFC1B /* platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF69CE51BD44F8B00DFFC1B /* platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BFF3714177E17C100192782 /* OFRemoveItemFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BFF3715177E17C100192782 /* OFRemoveItemFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */; }; /* End PBXBuildFile section */ |
︙ | ︙ | |||
1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 | 4BF1BCCC11C9663F0025511F /* OFString+XMLUnescaping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFString+XMLUnescaping.h"; path = "src/OFString+XMLUnescaping.h"; sourceTree = "<group>"; }; 4BF1BCCD11C9663F0025511F /* OFString+XMLUnescaping.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "OFString+XMLUnescaping.m"; path = "src/OFString+XMLUnescaping.m"; sourceTree = "<group>"; }; 4BF1BCCE11C9663F0025511F /* OFXMLAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFXMLAttribute.h; path = src/OFXMLAttribute.h; sourceTree = "<group>"; }; 4BF1BCCF11C9663F0025511F /* OFXMLAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFXMLAttribute.m; path = src/OFXMLAttribute.m; sourceTree = "<group>"; }; 4BF33AF0133807310059CEF7 /* Tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Tests; sourceTree = BUILT_PRODUCTS_DIR; }; 4BF33B4213380CD40059CEF7 /* testfile.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = testfile.bin; path = tests/testfile.bin; sourceTree = "<group>"; }; 4BF33B4313380CD40059CEF7 /* testfile.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = testfile.txt; path = tests/testfile.txt; sourceTree = "<group>"; }; 4BF48CDF18A95F83000E8D04 /* OFBigDataArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFBigDataArray.h; path = src/OFBigDataArray.h; sourceTree = "<group>"; }; 4BF48CE018A95F83000E8D04 /* OFBigDataArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFBigDataArray.m; path = src/OFBigDataArray.m; sourceTree = "<group>"; }; 4BF69CE51BD44F8B00DFFC1B /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform.h; path = src/platform.h; sourceTree = "<group>"; }; 4BFBDD1610A0724800051AFB /* unicode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = unicode.m; path = src/unicode.m; sourceTree = "<group>"; }; 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFRemoveItemFailedException.h; path = src/exceptions/OFRemoveItemFailedException.h; sourceTree = "<group>"; }; 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFRemoveItemFailedException.m; path = src/exceptions/OFRemoveItemFailedException.m; sourceTree = "<group>"; }; /* End PBXFileReference section */ | > | 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 | 4BF1BCCC11C9663F0025511F /* OFString+XMLUnescaping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFString+XMLUnescaping.h"; path = "src/OFString+XMLUnescaping.h"; sourceTree = "<group>"; }; 4BF1BCCD11C9663F0025511F /* OFString+XMLUnescaping.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "OFString+XMLUnescaping.m"; path = "src/OFString+XMLUnescaping.m"; sourceTree = "<group>"; }; 4BF1BCCE11C9663F0025511F /* OFXMLAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFXMLAttribute.h; path = src/OFXMLAttribute.h; sourceTree = "<group>"; }; 4BF1BCCF11C9663F0025511F /* OFXMLAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFXMLAttribute.m; path = src/OFXMLAttribute.m; sourceTree = "<group>"; }; 4BF33AF0133807310059CEF7 /* Tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Tests; sourceTree = BUILT_PRODUCTS_DIR; }; 4BF33B4213380CD40059CEF7 /* testfile.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = testfile.bin; path = tests/testfile.bin; sourceTree = "<group>"; }; 4BF33B4313380CD40059CEF7 /* testfile.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = testfile.txt; path = tests/testfile.txt; sourceTree = "<group>"; }; 4BF3A2281E25EA48002EA46F /* windows_1251.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = windows_1251.m; path = src/windows_1251.m; sourceTree = "<group>"; }; 4BF48CDF18A95F83000E8D04 /* OFBigDataArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFBigDataArray.h; path = src/OFBigDataArray.h; sourceTree = "<group>"; }; 4BF48CE018A95F83000E8D04 /* OFBigDataArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFBigDataArray.m; path = src/OFBigDataArray.m; sourceTree = "<group>"; }; 4BF69CE51BD44F8B00DFFC1B /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform.h; path = src/platform.h; sourceTree = "<group>"; }; 4BFBDD1610A0724800051AFB /* unicode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = unicode.m; path = src/unicode.m; sourceTree = "<group>"; }; 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFRemoveItemFailedException.h; path = src/exceptions/OFRemoveItemFailedException.h; sourceTree = "<group>"; }; 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFRemoveItemFailedException.m; path = src/exceptions/OFRemoveItemFailedException.m; sourceTree = "<group>"; }; /* End PBXFileReference section */ |
︙ | ︙ | |||
2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 | 4B40EC1A189FE2650031E19E /* socket.m */, 4B7DD58118942FE200990FD6 /* socket_helpers.h */, 4B67998B1099E7C50041064A /* threading.h */, 4B3379CE1979326A0088E97E /* threading.m */, 4BABC29A197A8212006A93BD /* threading_pthread.m */, 4B67998C1099E7C50041064A /* unicode.h */, 4BFBDD1610A0724800051AFB /* unicode.m */, 4B6AF97210A8D42E0003FB0A /* windows_1252.m */, ); name = ObjFW; sourceTree = "<group>"; }; 4B6EF66D123535480076B512 /* Tests */ = { isa = PBXGroup; | > | 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 | 4B40EC1A189FE2650031E19E /* socket.m */, 4B7DD58118942FE200990FD6 /* socket_helpers.h */, 4B67998B1099E7C50041064A /* threading.h */, 4B3379CE1979326A0088E97E /* threading.m */, 4BABC29A197A8212006A93BD /* threading_pthread.m */, 4B67998C1099E7C50041064A /* unicode.h */, 4BFBDD1610A0724800051AFB /* unicode.m */, 4BF3A2281E25EA48002EA46F /* windows_1251.m */, 4B6AF97210A8D42E0003FB0A /* windows_1252.m */, ); name = ObjFW; sourceTree = "<group>"; }; 4B6EF66D123535480076B512 /* Tests */ = { isa = PBXGroup; |
︙ | ︙ | |||
3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 | 4B2C218F1DA292BE00735907 /* of_strptime.m in Sources */, 4B2C21901DA292BE00735907 /* pbkdf2.m in Sources */, 4B2C21911DA292BE00735907 /* resolver.m in Sources */, 4B2C21921DA292BE00735907 /* scrypt.m in Sources */, 4B2C21931DA292BE00735907 /* socket.m in Sources */, 4B2C21941DA292BE00735907 /* threading.m in Sources */, 4B2C21961DA292BE00735907 /* unicode.m in Sources */, 4B2C21971DA292BE00735907 /* windows_1252.m in Sources */, 4B2C21981DA292BE00735907 /* OFAcceptFailedException.m in Sources */, 4B2C21991DA292BE00735907 /* OFObject+KeyValueCoding.m in Sources */, 4B2C219A1DA292BE00735907 /* OFAddressTranslationFailedException.m in Sources */, 4B2C219B1DA292BE00735907 /* OFAllocFailedException.m in Sources */, 4B2C219C1DA292BE00735907 /* OFAlreadyConnectedException.m in Sources */, 4B2C219D1DA292BE00735907 /* OFBindFailedException.m in Sources */, | > | 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 | 4B2C218F1DA292BE00735907 /* of_strptime.m in Sources */, 4B2C21901DA292BE00735907 /* pbkdf2.m in Sources */, 4B2C21911DA292BE00735907 /* resolver.m in Sources */, 4B2C21921DA292BE00735907 /* scrypt.m in Sources */, 4B2C21931DA292BE00735907 /* socket.m in Sources */, 4B2C21941DA292BE00735907 /* threading.m in Sources */, 4B2C21961DA292BE00735907 /* unicode.m in Sources */, 4BF3A22A1E25EA48002EA46F /* windows_1251.m in Sources */, 4B2C21971DA292BE00735907 /* windows_1252.m in Sources */, 4B2C21981DA292BE00735907 /* OFAcceptFailedException.m in Sources */, 4B2C21991DA292BE00735907 /* OFObject+KeyValueCoding.m in Sources */, 4B2C219A1DA292BE00735907 /* OFAddressTranslationFailedException.m in Sources */, 4B2C219B1DA292BE00735907 /* OFAllocFailedException.m in Sources */, 4B2C219C1DA292BE00735907 /* OFAlreadyConnectedException.m in Sources */, 4B2C219D1DA292BE00735907 /* OFBindFailedException.m in Sources */, |
︙ | ︙ | |||
3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 | 4BA355BA14879BDD00442EF4 /* of_strptime.m in Sources */, 4BD306351D46CEE300E2F372 /* pbkdf2.m in Sources */, 4B7769EE1895C07D00D12284 /* resolver.m in Sources */, 4B6994481D47FB1A007F34DF /* scrypt.m in Sources */, 4B40EC1B189FE2650031E19E /* socket.m in Sources */, 4B3379CF1979326A0088E97E /* threading.m in Sources */, 4B3D23B91337FC0D00DD29B8 /* unicode.m in Sources */, 4B3D23BA1337FC0D00DD29B8 /* windows_1252.m in Sources */, 4B90B79F133AD87D00BD33CB /* OFAcceptFailedException.m in Sources */, 4BC176311D04963000C32718 /* OFObject+KeyValueCoding.m in Sources */, 4B90B7A1133AD87D00BD33CB /* OFAddressTranslationFailedException.m in Sources */, 4B17FF80133A2D17003E6DCD /* OFAllocFailedException.m in Sources */, 4B90B78E133AD46700BD33CB /* OFAlreadyConnectedException.m in Sources */, 4B90B7A3133AD87D00BD33CB /* OFBindFailedException.m in Sources */, | > | 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 | 4BA355BA14879BDD00442EF4 /* of_strptime.m in Sources */, 4BD306351D46CEE300E2F372 /* pbkdf2.m in Sources */, 4B7769EE1895C07D00D12284 /* resolver.m in Sources */, 4B6994481D47FB1A007F34DF /* scrypt.m in Sources */, 4B40EC1B189FE2650031E19E /* socket.m in Sources */, 4B3379CF1979326A0088E97E /* threading.m in Sources */, 4B3D23B91337FC0D00DD29B8 /* unicode.m in Sources */, 4BF3A2291E25EA48002EA46F /* windows_1251.m in Sources */, 4B3D23BA1337FC0D00DD29B8 /* windows_1252.m in Sources */, 4B90B79F133AD87D00BD33CB /* OFAcceptFailedException.m in Sources */, 4BC176311D04963000C32718 /* OFObject+KeyValueCoding.m in Sources */, 4B90B7A1133AD87D00BD33CB /* OFAddressTranslationFailedException.m in Sources */, 4B17FF80133A2D17003E6DCD /* OFAllocFailedException.m in Sources */, 4B90B78E133AD46700BD33CB /* OFAlreadyConnectedException.m in Sources */, 4B90B7A3133AD87D00BD33CB /* OFBindFailedException.m in Sources */, |
︙ | ︙ |
Modified src/Makefile from [374f171e27] to [1e97ec4295].
︙ | ︙ | |||
156 157 158 159 160 161 162 163 164 165 166 167 168 169 | codepage_437.m \ codepage_850.m \ ${FOUNDATION_COMPAT_M} \ ${INSTANCE_M} \ iso_8859_15.m \ mac_roman.m \ ${UNICODE_M} \ windows_1252.m SRCS_FILES += OFSettings_INIFile.m SRCS_SOCKETS += ${OFKERNELEVENTOBSERVER_EPOLL_M} \ ${OFKERNELEVENTOBSERVER_KQUEUE_M} \ ${OFKERNELEVENTOBSERVER_POLL_M} \ ${OFKERNELEVENTOBSERVER_SELECT_M} \ OFTCPSocket+SOCKS5.m | > | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | codepage_437.m \ codepage_850.m \ ${FOUNDATION_COMPAT_M} \ ${INSTANCE_M} \ iso_8859_15.m \ mac_roman.m \ ${UNICODE_M} \ windows_1251.m \ windows_1252.m SRCS_FILES += OFSettings_INIFile.m SRCS_SOCKETS += ${OFKERNELEVENTOBSERVER_EPOLL_M} \ ${OFKERNELEVENTOBSERVER_KQUEUE_M} \ ${OFKERNELEVENTOBSERVER_POLL_M} \ ${OFKERNELEVENTOBSERVER_SELECT_M} \ OFTCPSocket+SOCKS5.m |
︙ | ︙ |
Modified src/OFHTTPResponse.m from [7bcf69b951] to [53242c671e].
︙ | ︙ | |||
109 110 111 112 113 114 115 | if (encoding == OF_STRING_ENCODING_AUTODETECT && (contentType = [_headers objectForKey: @"Content-Type"]) != nil) { contentType = [contentType lowercaseString]; if ([contentType hasSuffix: @"charset=utf-8"]) encoding = OF_STRING_ENCODING_UTF_8; | | | > > | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | if (encoding == OF_STRING_ENCODING_AUTODETECT && (contentType = [_headers objectForKey: @"Content-Type"]) != nil) { contentType = [contentType lowercaseString]; if ([contentType hasSuffix: @"charset=utf-8"]) encoding = OF_STRING_ENCODING_UTF_8; else if ([contentType hasSuffix: @"charset=iso-8859-1"]) encoding = OF_STRING_ENCODING_ISO_8859_1; else if ([contentType hasSuffix: @"charset=iso-8859-15"]) encoding = OF_STRING_ENCODING_ISO_8859_15; else if ([contentType hasSuffix: @"charset=windows-1251"]) encoding = OF_STRING_ENCODING_WINDOWS_1251; else if ([contentType hasSuffix: @"charset=windows-1252"]) encoding = OF_STRING_ENCODING_WINDOWS_1252; else if ([contentType hasSuffix: @"charset=macintosh"]) encoding = OF_STRING_ENCODING_MAC_ROMAN; } if (encoding == OF_STRING_ENCODING_AUTODETECT) encoding = OF_STRING_ENCODING_UTF_8; data = [self readDataArrayTillEndOfStream]; |
︙ | ︙ |
Modified src/OFLocalization.m from [5e507e5b86] to [9170e13ef8].
︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 | else if (strcmp(tmp, "iso8859-1") == 0 || strcmp(tmp, "iso-8859-1") == 0) _encoding = OF_STRING_ENCODING_ISO_8859_1; else if (strcmp(tmp, "iso8859-15") == 0 || strcmp(tmp, "iso-8859-15") == 0) _encoding = OF_STRING_ENCODING_ISO_8859_15; /* Windows uses a codepage */ else if (strcmp(tmp, "1252") == 0) _encoding = OF_STRING_ENCODING_WINDOWS_1252; } /* Territory */ if ((tmp = strrchr(locale, '_')) != NULL) { *tmp++ = '\0'; | > > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | else if (strcmp(tmp, "iso8859-1") == 0 || strcmp(tmp, "iso-8859-1") == 0) _encoding = OF_STRING_ENCODING_ISO_8859_1; else if (strcmp(tmp, "iso8859-15") == 0 || strcmp(tmp, "iso-8859-15") == 0) _encoding = OF_STRING_ENCODING_ISO_8859_15; /* Windows uses a codepage */ else if (strcmp(tmp, "1251") == 0) _encoding = OF_STRING_ENCODING_WINDOWS_1251; else if (strcmp(tmp, "1252") == 0) _encoding = OF_STRING_ENCODING_WINDOWS_1252; } /* Territory */ if ((tmp = strrchr(locale, '_')) != NULL) { *tmp++ = '\0'; |
︙ | ︙ |
Modified src/OFString.h from [78eb3b06a4] to [9936d08fa6].
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | OF_STRING_ENCODING_UTF_8, /*! ASCII */ OF_STRING_ENCODING_ASCII, /*! ISO 8859-1 */ OF_STRING_ENCODING_ISO_8859_1, /*! ISO 8859-15 */ OF_STRING_ENCODING_ISO_8859_15, /*! Windows-1252 */ OF_STRING_ENCODING_WINDOWS_1252, /*! Codepage 437 */ OF_STRING_ENCODING_CODEPAGE_437, /*! Codepage 850 */ OF_STRING_ENCODING_CODEPAGE_850, /*! Mac OS Roman */ | > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | OF_STRING_ENCODING_UTF_8, /*! ASCII */ OF_STRING_ENCODING_ASCII, /*! ISO 8859-1 */ OF_STRING_ENCODING_ISO_8859_1, /*! ISO 8859-15 */ OF_STRING_ENCODING_ISO_8859_15, /*! Windows-1251 */ OF_STRING_ENCODING_WINDOWS_1251, /*! Windows-1252 */ OF_STRING_ENCODING_WINDOWS_1252, /*! Codepage 437 */ OF_STRING_ENCODING_CODEPAGE_437, /*! Codepage 850 */ OF_STRING_ENCODING_CODEPAGE_850, /*! Mac OS Roman */ |
︙ | ︙ |
Modified src/OFString.m from [a66e682c7d] to [c458b1a41f].
︙ | ︙ | |||
87 88 89 90 91 92 93 94 95 96 97 98 99 100 | lossy: (bool)lossy; - (OFString*)OF_JSONRepresentationWithOptions: (int)options depth: (size_t)depth; @end extern bool of_unicode_to_iso_8859_15(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); extern bool of_unicode_to_codepage_437(const of_unichar_t*, unsigned char*, size_t, bool); extern bool of_unicode_to_codepage_850(const of_unichar_t*, unsigned char*, size_t, bool); extern bool of_unicode_to_mac_roman(const of_unichar_t*, unsigned char*, | > > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | lossy: (bool)lossy; - (OFString*)OF_JSONRepresentationWithOptions: (int)options depth: (size_t)depth; @end 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); extern bool of_unicode_to_codepage_437(const of_unichar_t*, unsigned char*, size_t, bool); extern bool of_unicode_to_codepage_850(const of_unichar_t*, unsigned char*, size_t, bool); extern bool of_unicode_to_mac_roman(const of_unichar_t*, unsigned char*, |
︙ | ︙ | |||
949 950 951 952 953 954 955 | if (encoding == OF_STRING_ENCODING_AUTODETECT && (contentType = [headers objectForKey: @"Content-Type"]) != nil) { contentType = [contentType lowercaseString]; if ([contentType hasSuffix: @"charset=utf-8"]) encoding = OF_STRING_ENCODING_UTF_8; | | | > | > > > > | | 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | if (encoding == OF_STRING_ENCODING_AUTODETECT && (contentType = [headers objectForKey: @"Content-Type"]) != nil) { contentType = [contentType lowercaseString]; if ([contentType hasSuffix: @"charset=utf-8"]) encoding = OF_STRING_ENCODING_UTF_8; else if ([contentType hasSuffix: @"charset=iso-8859-1"]) encoding = OF_STRING_ENCODING_ISO_8859_1; else if ([contentType hasSuffix: @"charset=iso-8859-15"]) encoding = OF_STRING_ENCODING_ISO_8859_15; else if ([contentType hasSuffix: @"charset=windows-1251"]) encoding = OF_STRING_ENCODING_WINDOWS_1251; else if ([contentType hasSuffix: @"charset=windows-1252"]) encoding = OF_STRING_ENCODING_WINDOWS_1252; else if ([contentType hasSuffix: @"charset=macintosh"]) encoding = OF_STRING_ENCODING_MAC_ROMAN; } if (encoding == OF_STRING_ENCODING_AUTODETECT) encoding = OF_STRING_ENCODING_UTF_8; data = [response readDataArrayTillEndOfStream]; |
︙ | ︙ | |||
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 | if (!of_unicode_to_iso_8859_15(characters, (unsigned char*)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; case OF_STRING_ENCODING_WINDOWS_1252: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_windows_1252(characters, (unsigned char*)cString, length, lossy)) | > > > > > > > > > > > | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 | if (!of_unicode_to_iso_8859_15(characters, (unsigned char*)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; case OF_STRING_ENCODING_WINDOWS_1251: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_windows_1251(characters, (unsigned char*)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; case OF_STRING_ENCODING_WINDOWS_1252: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_windows_1252(characters, (unsigned char*)cString, length, lossy)) |
︙ | ︙ | |||
1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 | /* 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_15: case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: case OF_STRING_ENCODING_CODEPAGE_850: case OF_STRING_ENCODING_MAC_ROMAN: cString = [object allocMemoryWithSize: length + 1]; [self OF_getCString: cString | > | 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 | /* 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_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_MAC_ROMAN: cString = [object allocMemoryWithSize: length + 1]; [self OF_getCString: cString |
︙ | ︙ | |||
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 | UTF8StringLength += len; } return UTF8StringLength; case OF_STRING_ENCODING_ASCII: case OF_STRING_ENCODING_ISO_8859_1: case OF_STRING_ENCODING_ISO_8859_15: case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: case OF_STRING_ENCODING_CODEPAGE_850: case OF_STRING_ENCODING_MAC_ROMAN: return [self length]; default: @throw [OFInvalidEncodingException exception]; | > | 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | UTF8StringLength += len; } return UTF8StringLength; case OF_STRING_ENCODING_ASCII: case OF_STRING_ENCODING_ISO_8859_1: 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_MAC_ROMAN: return [self length]; default: @throw [OFInvalidEncodingException exception]; |
︙ | ︙ |
Modified src/OFString_UTF8.m from [38f6296657] to [fe504fcb59].
︙ | ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "of_asprintf.h" #import "unicode.h" extern const of_char16_t of_iso_8859_15[128]; extern const of_char16_t of_windows_1252[128]; extern const of_char16_t of_codepage_437[128]; extern const of_char16_t of_codepage_850[128]; extern const of_char16_t of_mac_roman[128]; static inline int memcasecmp(const char *first, const char *second, size_t length) | > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "of_asprintf.h" #import "unicode.h" extern const of_char16_t of_iso_8859_15[128]; extern const of_char16_t of_windows_1251[128]; extern const of_char16_t of_windows_1252[128]; extern const of_char16_t of_codepage_437[128]; extern const of_char16_t of_codepage_850[128]; extern const of_char16_t of_mac_roman[128]; static inline int memcasecmp(const char *first, const char *second, size_t length) |
︙ | ︙ | |||
286 287 288 289 290 291 292 293 294 295 296 297 298 299 | return self; } switch (encoding) { case OF_STRING_ENCODING_ISO_8859_15: table = of_iso_8859_15; break; case OF_STRING_ENCODING_WINDOWS_1252: table = of_windows_1252; break; case OF_STRING_ENCODING_CODEPAGE_437: table = of_codepage_437; break; | > > > | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | return self; } switch (encoding) { case OF_STRING_ENCODING_ISO_8859_15: table = of_iso_8859_15; break; case OF_STRING_ENCODING_WINDOWS_1251: table = of_windows_1251; break; case OF_STRING_ENCODING_WINDOWS_1252: table = of_windows_1252; break; case OF_STRING_ENCODING_CODEPAGE_437: table = of_codepage_437; break; |
︙ | ︙ |
Modified src/OFXMLParser.m from [ab4dd1b1f9] to [d432f9b587].
︙ | ︙ | |||
468 469 470 471 472 473 474 475 476 477 478 479 480 481 | _encoding = OF_STRING_ENCODING_UTF_8; else if ([value isEqual: @"iso-8859-1"]) _encoding = OF_STRING_ENCODING_ISO_8859_1; else if ([value isEqual: @"iso-8859-15"]) _encoding = OF_STRING_ENCODING_ISO_8859_15; else if ([value isEqual: @"windows-1252"]) _encoding = OF_STRING_ENCODING_WINDOWS_1252; else if ([value isEqual: @"macintosh"]) _encoding = OF_STRING_ENCODING_MAC_ROMAN; else | > > > | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | _encoding = OF_STRING_ENCODING_UTF_8; else if ([value isEqual: @"iso-8859-1"]) _encoding = OF_STRING_ENCODING_ISO_8859_1; else if ([value isEqual: @"iso-8859-15"]) _encoding = OF_STRING_ENCODING_ISO_8859_15; else if ([value isEqual: @"windows-1251"]) _encoding = OF_STRING_ENCODING_WINDOWS_1251; else if ([value isEqual: @"windows-1252"]) _encoding = OF_STRING_ENCODING_WINDOWS_1252; else if ([value isEqual: @"macintosh"]) _encoding = OF_STRING_ENCODING_MAC_ROMAN; else |
︙ | ︙ |
Added src/windows_1251.m version [6ea0727109].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 * Jonathan Schleifer <js@heap.zone> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFString.h" const of_char16_t of_windows_1251[128] = { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFF, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F }; bool of_unicode_to_windows_1251(const of_unichar_t *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; } else return false; } if (c >= 0x410 && c <= 0x44F) output[i] = 0xC0 + (c - 0x410); else { switch ((of_char16_t)c) { case 0x402: output[i] = 0x80; break; case 0x403: output[i] = 0x81; break; case 0x201A: output[i] = 0x82; break; case 0x453: output[i] = 0x83; break; case 0x201E: output[i] = 0x84; break; case 0x2026: output[i] = 0x85; break; case 0x2020: output[i] = 0x86; break; case 0x2021: output[i] = 0x87; break; case 0x20AC: output[i] = 0x88; break; case 0x2030: output[i] = 0x89; break; case 0x409: output[i] = 0x8A; break; case 0x2039: output[i] = 0x8B; break; case 0x40A: output[i] = 0x8C; break; case 0x40C: output[i] = 0x8D; break; case 0x40B: output[i] = 0x8E; break; case 0x40F: output[i] = 0x8F; break; case 0x452: output[i] = 0x90; break; case 0x2018: output[i] = 0x91; break; case 0x2019: output[i] = 0x92; break; case 0x201C: output[i] = 0x93; break; case 0x201D: output[i] = 0x94; break; case 0x2022: output[i] = 0x95; break; case 0x2013: output[i] = 0x96; break; case 0x2014: output[i] = 0x97; break; case 0x2122: output[i] = 0x99; break; case 0x459: output[i] = 0x9A; break; case 0x203A: output[i] = 0x9B; break; case 0x45A: output[i] = 0x9C; break; case 0x45C: output[i] = 0x9D; break; case 0x45B: output[i] = 0x9E; break; case 0x45F: output[i] = 0x9F; break; case 0xA0: output[i] = 0xA0; break; case 0x40E: output[i] = 0xA1; break; case 0x45E: output[i] = 0xA2; break; case 0x408: output[i] = 0xA3; break; case 0xA4: output[i] = 0xA4; break; case 0x490: output[i] = 0xA5; break; case 0xA6: output[i] = 0xA6; break; case 0xA7: output[i] = 0xA7; break; case 0x401: output[i] = 0xA8; break; case 0xA9: output[i] = 0xA9; break; case 0x404: output[i] = 0xAA; break; case 0xAB: output[i] = 0xAB; break; case 0xAC: output[i] = 0xAC; break; case 0xAD: output[i] = 0xAD; break; case 0xAE: output[i] = 0xAE; break; case 0x407: output[i] = 0xAF; break; case 0xB0: output[i] = 0xB0; break; case 0xB1: output[i] = 0xB1; break; case 0x406: output[i] = 0xB2; break; case 0x456: output[i] = 0xB3; break; case 0x491: output[i] = 0xB4; break; case 0xB5: output[i] = 0xB5; break; case 0xB6: output[i] = 0xB6; break; case 0xB7: output[i] = 0xB7; break; case 0x451: output[i] = 0xB8; break; case 0x2116: output[i] = 0xB9; break; case 0x454: output[i] = 0xBA; break; case 0xBB: output[i] = 0xBB; break; case 0x458: output[i] = 0xBC; break; case 0x405: output[i] = 0xBD; break; case 0x455: output[i] = 0xBE; break; case 0x457: output[i] = 0xBF; break; default: if (lossy) output[i] = '?'; else return false; break; } } } else output[i] = (unsigned char)c; } return true; } |