Skip to content

Commit

Permalink
Fix JuliaLang#11379 deprecate utf32(Integer...)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottPJones authored and mbauman committed Jun 5, 2015
1 parent 9794e92 commit 729637a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
==========================

Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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])
9 changes: 0 additions & 9 deletions base/utf32.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/unicode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 729637a

Please sign in to comment.