@@ -36,27 +36,26 @@ julia> decode(ans, "UTF-16")
3636Use the` encodings ` function to get the list of all supported encodings on the current platform:
3737``` julia
3838julia> encodings ()
39- 1241 - element Array{String,1 }:
40- " 1026"
41- " 1046"
42- " 1047"
43- " 10646-1:1993"
44- " 10646-1:1993/UCS4"
45- " 437"
46- " 500"
47- " 500V1"
48- " 850"
49- " 851"
50- ⋮
51- " windows-1258"
52- " WINDOWS-1258"
53- " WINDOWS-31J"
54- " windows-874"
55- " WINDOWS-874"
56- " WINDOWS-936"
57- " WINSAMI2"
58- " WS2"
59- " YU"
39+ 411 - element Array{String,1 }:
40+ " 850"
41+ " 862"
42+ " 866"
43+ " ANSI_X3.4-1968"
44+ " ANSI_X3.4-1986"
45+ " ARABIC"
46+ " ARMSCII-8"
47+ " ASCII"
48+ " ASMO-708"
49+ ⋮
50+ " WINDOWS-1257"
51+ " windows-1258"
52+ " WINDOWS-1258"
53+ " windows-874"
54+ " WINDOWS-874"
55+ " WINDOWS-936"
56+ " X0201"
57+ " X0208"
58+ " X0212"
6059```
6160
6261(Note that many of these are aliases for standard names.)
@@ -77,15 +76,15 @@ julia> path = tempname();
7776
7877julia> f= open (path,enc " UTF-16" ," w" );
7978
80- julia> write (f," café\n noël" )
79+ julia> write (f," café\n noël" );
8180
8281julia> close (f);# Essential to complete encoding
8382```
8483
8584The contents of the file can then be read back using` read(path, String) ` :
8685``` julia
8786julia> read (path, String)# Standard function expects UTF-8
88- " \U 3d83f7c0f \0 澊 \ 0 n\0 o\0 迬 \0 "
87+ " \x fe \x ff \0 c \0 a \0 f \0\x e9 \0\n\ 0 n\0 o\0\x eb \0 l "
8988
9089julia> read (path, String,enc " UTF-16" )# Works when passing the correct encoding
9190" café\n noël"
@@ -94,20 +93,20 @@ julia> read(path, String, enc"UTF-16") # Works when passing the correct encoding
9493Other variants of standard convenience functions are provided:
9594``` julia
9695julia> readline (path,enc " UTF-16" )
97- " café\n "
96+ " café"
9897
9998julia> readlines (path,enc " UTF-16" )
100992 - element Array{String,1 }:
101- " café\n "
100+ " café"
102101" noël"
103102
104103julia> for lin eachline (path,enc " UTF-16" )
105- print (l)
104+ println (l)
106105end
107106café
108107noël
109108
110- julia> readuntil (path,enc " UTF-16" ," o " )
109+ julia> readuntil (path,enc " UTF-16" ," ë " )
111110" café\n no"
112111```
113112
@@ -121,6 +120,8 @@ julia> read(io, String)
121120
122121In particular, this method allows reading encoded comma-separated values (CSV) and other character-delimited text files:
123122``` julia
123+ julia> using DelimitedFiles
124+
124125julia> open (readcsv, path,enc " UTF-16" )
1251262 x1 Array{Any,2 }:
126127" café"