I've written the following code:
import Base.convert
function convert(::Type{UTF8String}, x::Int64)
return utf8(string(x))
end
println(convert(UTF8String, 10))
println(convert(Array{UTF8String, 1}, [10]))
The intent is to convert an Array of Int64 into an Array of UTF8String.
The first println works correctly and converts 10 into "10"
The second println should print an array of ["10"], but instead gives me
the following error:
type: arrayset: expected UTF8String, got ASCIIString
while loading In[41], in expression starting on line 6
in copy! at abstractarray.jl:149
in convert at array.jl:220
I'm using Julia 0.3.6
Any idea on what I'm doing wrong?
Thanks,
Philip