diff --git a/NEWS.md b/NEWS.md index 97954f933a130..777fc3ca7d349 100644 --- a/NEWS.md +++ b/NEWS.md @@ -385,6 +385,8 @@ Deprecated or removed The two argument form `isvalid(type, value)` can be used with the above types, with values of type `Vector{UInt8}`, `Vector{UInt16}`, `Vector{UInt32}`, and `Vector{Char}` ([#11241]). + * Instead of `utf32(64,123,...)` use `utf32(UInt32[64,123,...])` ([#11379]). + Julia v0.3.0 Release Notes ========================== @@ -1432,3 +1434,4 @@ Too numerous to mention. [#11145]: https://github.com/JuliaLang/julia/issues/11145 [#11171]: https://github.com/JuliaLang/julia/issues/11171 [#11241]: https://github.com/JuliaLang/julia/issues/11241 +[#11379]: https://github.com/JuliaLang/julia/issues/11379 diff --git a/base/deprecated.jl b/base/deprecated.jl index acdb1b60a7735..2e406d599df42 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -466,3 +466,7 @@ end @deprecate is_valid_utf8(str) isvalid(UTF8String, str) @deprecate is_valid_utf16(str) isvalid(UTF16String, str) @deprecate is_valid_utf32(str) isvalid(UTF32String, str) + +# 11379 + +@deprecate utf32(c::Integer...) UTF32String(UInt32[c...,0]) diff --git a/base/utf32.jl b/base/utf32.jl index 3d6390cb21bdd..b183912491de0 100644 --- a/base/utf32.jl +++ b/base/utf32.jl @@ -18,15 +18,6 @@ next(s::UTF32String, i::Int) = (s.data[i], i+1) endof(s::UTF32String) = length(s.data) - 1 length(s::UTF32String) = length(s.data) - 1 -function utf32(c::Integer...) - a = Array(Char, length(c) + 1) - for i = 1:length(c) - a[i] = Char(c[i]) - end - a[end] = Char(0) - UTF32String(a) -end - utf32(x) = convert(UTF32String, x) convert(::Type{UTF32String}, c::Char) = UTF32String(Char[c, Char(0)]) convert(::Type{UTF32String}, s::UTF32String) = s diff --git a/test/unicode.jl b/test/unicode.jl index 6742e86786f53..5d3a64285ca83 100644 --- a/test/unicode.jl +++ b/test/unicode.jl @@ -80,12 +80,12 @@ else end str1 = "∀ ε > 0, ∃ δ > 0: |x-y| < δ ⇒ |f(x)-f(y)| < ε" - str2 = utf32( + str2 = UTF32String(UInt32[ 8704, 32, 949, 32, 62, 32, 48, 44, 32, 8707, 32, 948, 32, 62, 32, 48, 58, 32, 124, 120, 45, 121, 124, 32, 60, 32, 948, 32, 8658, 32, 124, 102, 40, 120, 41, 45, 102, 40, 121, 41, 124, 32, 60, 32, 949 - ) + ,0]) @test str1 == str2 # Cleanup unicode data