File tree 3 files changed +25
-23
lines changed
3 files changed +25
-23
lines changed Original file line number Diff line number Diff line change 47
47
48
48
// Codepage aliases borrowed from: https://github.com/win-iconv/win-iconv/blob/master/win_iconv.c
49
49
// (slightly modified for preferences, because it looks some iconv posix variants does not recognize CP1200 etc)
50
+ // On macOS it looks there are not aliased utf16 variants, one must use utf-16!
50
51
//
51
52
static struct {
52
53
REBINT codepage ;
53
54
const char * name ;
54
55
} codepage_alias [] = {
55
- {65001 , "UTF8" },
56
56
{65001 , "UTF-8" },
57
+ {65001 , "UTF8" },
57
58
{65001 , "CP65001" },
58
59
59
-
60
- {1200 , "UTF16LE" },
61
60
{1200 , "UTF-16LE" },
62
- {1200 , "UCS2LE " },
61
+ {1200 , "UTF16LE " },
63
62
{1200 , "UCS-2LE" },
63
+ {1200 , "UCS2LE" },
64
64
{1200 , "UCS-2-INTERNAL" },
65
65
{1200 , "CP1200" },
66
66
67
- {1201 , "UTF16BE" },
68
67
{1201 , "UTF-16BE" },
69
- {1201 , "UCS2BE " },
68
+ {1201 , "UTF16BE " },
70
69
{1201 , "UCS-2BE" },
70
+ {1201 , "UCS2BE" },
71
71
{1201 , "unicodeFFFE" },
72
72
{1201 , "CP1201" },
73
73
74
74
{12000 , "CP12000" },
75
- {12000 , "UTF32LE" },
76
75
{12000 , "UTF-32LE" },
77
- {12000 , "UCS4LE " },
76
+ {12000 , "UTF32LE " },
78
77
{12000 , "UCS-4LE" },
78
+ {12000 , "UCS4LE" },
79
79
80
- {12001 , "UTF32BE" },
81
80
{12001 , "UTF-32BE" },
82
- {12001 , "UCS4BE " },
81
+ {12001 , "UTF32BE " },
83
82
{12001 , "UCS-4BE" },
83
+ {12001 , "UCS4BE" },
84
84
{12001 , "CP12001" },
85
85
86
86
//#ifndef GLIB_COMPILATION
@@ -98,14 +98,14 @@ static struct {
98
98
// {12001, "UCS4"},
99
99
//#else
100
100
/* Default is little endian, because the platform is */
101
- {1200 , "UTF16" },
102
101
{1200 , "UTF-16" },
103
- {1200 , "UCS2 " },
102
+ {1200 , "UTF16 " },
104
103
{1200 , "UCS-2" },
105
- {12000 , "UTF32 " },
104
+ {1200 , "UCS2 " },
106
105
{12000 , "UTF-32" },
107
- {12000 , "UCS4 " },
106
+ {12000 , "UTF32 " },
108
107
{12000 , "UCS-4" },
108
+ {12000 , "UCS4" },
109
109
//#endif
110
110
111
111
/* copy from libiconv `iconv -l` */
@@ -715,9 +715,10 @@ static REBYTE* get_codepage_name(REBVAL *cp)
715
715
if (!tocode ) Trap1 (RE_INVALID_ARG , val_to );
716
716
wide = 1 ; // result is raw binary series
717
717
} else {
718
- tocode = "UTF16LE " ;
718
+ tocode = "UTF-16LE " ;
719
719
wide = 2 ; // result is string
720
720
}
721
+ //printf("iconv_open %s %s\n", tocode, fromcode);
721
722
cd = iconv_open (tocode , fromcode );
722
723
if (cd == (iconv_t )- 1 ) {
723
724
if (get_codepage_id (val_from ) < 0 ) Trap1 (RE_INVALID_ARG , val_from );
Original file line number Diff line number Diff line change @@ -198,14 +198,14 @@ Rebol [
198
198
;- using UTF-16LE instead of just UTF-16 as iconv function on posix adds BOM if just UTF16 is used
199
199
--assert #{ 50005901 } = iconv/to #{ 50F8 } 28592 'UTF-16LE
200
200
--assert #{ 5901 } = iconv/to next #{ 50F8 } 28592 'UTF-16LE
201
- --assert #{ 50005100 } = iconv/to #{ 50005100 } 'UTF16LE 'UTF16LE
202
- --assert #{ 00500051 } = iconv/to #{ 00500051 } 'UTF16BE 'UTF16BE
201
+ --assert #{ 50005100 } = iconv/to #{ 50005100 } 'UTF-16LE 'UTF-16LE
202
+ --assert #{ 00500051 } = iconv/to #{ 00500051 } 'UTF-16BE 'UTF-16BE
203
203
204
204
--assert #{ 00500159 } = iconv/to #{ 50F8 } 28592 'UTF-16BE
205
205
--assert #{ 0159 } = iconv/to next #{ 50F8 } 28592 'UTF-16BE
206
- --assert #{ 00500051 } = bin: iconv/to #{ 50005100 } 'UTF16LE 'UTF16BE
207
- --assert #{ 50005100 } = iconv/to bin 'UTF16BE 'UTF16LE
208
- --assert "PQ" = iconv bin 'UTF16BE
206
+ --assert #{ 00500051 } = bin: iconv/to #{ 50005100 } 'UTF-16LE 'UTF-16BE
207
+ --assert #{ 50005100 } = iconv/to bin 'UTF-16BE 'UTF-16LE
208
+ --assert "PQ" = iconv bin 'UTF-16BE
209
209
210
210
--test-- "ICONV with nonsense codepages"
211
211
--assert error? try [iconv #{ 30 } 'foo]
Original file line number Diff line number Diff line change @@ -21,9 +21,9 @@ REBOL [
21
21
systems: [
22
22
[plat os-name os-base build-flags]
23
23
[0.1.03 "amiga" posix [BEN HID NPS +SC CMT COP -SP -LM]]
24
- [0.2.04 "osx" posix [BEN +OS NCM -LM UOP]] ; OSX/PPC; no shared lib possible
25
- [0.2.05 "osxi" posix [LEN +O1 PIC NPS NCM HID STX -LM UOP ARC FCS FCM]]
26
- [0.2.40 "osx_x64" posix [LEN +O1 PIC NPS NCM HID STX -LM UOP L64 FCS FCM]]
24
+ [0.2.04 "osx" posix [BEN +OS NCM -LM UOP LIC ]] ; OSX/PPC; no shared lib possible
25
+ [0.2.05 "osxi" posix [LEN +OS PIC NPS NCM HID STX -LM UOP ARC FCS FCM LIC ]]
26
+ [0.2.40 "osx_x64" posix [LEN +OS PIC NPS NCM HID STX -LM UOP L64 FCS FCM LIC ]]
27
27
[0.3.01 "win32" win32 [LEN +O2 UNI M32 W32 CON S4M EXE DIR -LM]]
28
28
[0.3.40 "win32_x64" win32 [LEN +O2 UNI M64 W32 CON S4M EXE DIR -LM P64]]
29
29
[0.4.02 "linux" posix [LEN +O2 PIC LDL ST1 -LM]] ; libc 2.3
@@ -70,6 +70,7 @@ linker-flags: [
70
70
MAP: "-Wl,-M" ; output a map
71
71
STA: "--strip-all"
72
72
LDL: "-ldl" ; link with dynamic lib lib
73
+ LIC: "-liconv" ; macOS (clang?) needs iconv to be explicitly linked (for iconv native function)
73
74
LLOG: "-llog" ; on Android, link with liblog.so
74
75
ARC: "-arch i386" ; x86 32 bit architecture (OSX)
75
76
M32: "-m32" ; use 32-bit memory model (Linux x64)
You can’t perform that action at this time.
0 commit comments