# \`transcode(String, arr)\` sets the \`arr\` length to 0 elements

**URL:** https://discourse.julialang.org/t/transcode-string-arr-sets-the-arr-length-to-0-elements/25751
**Category:** Internals & Design
**Created:** [June 27, 2019, 6:48am UTC](https://discourse.julialang.org/t/transcode-string-arr-sets-the-arr-length-to-0-elements/25751 "2019-06-27T06:48:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)
#### Post date: [June 27, 2019, 6:48am UTC](https://discourse.julialang.org/t/transcode-string-arr-sets-the-arr-length-to-0-elements/25751/1 "2019-06-27T06:48:07Z")

</div>

Hi All,

Is this behavior of `transcode` expected? Should `transcode` not be a function without side effects?

regards,

Sambit

```julia
julia> PADDING1 =
           [0x28, 0xBF, 0x4E, 0x5E]
4-element Array{UInt8,1}:
 0x28
 0xbf
 0x4e
 0x5e

julia> str = transcode(String, PADDING1)
"(\xbfN^"

julia> PADDING1
0-element Array{UInt8,1}

julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

```

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [June 27, 2019, 7:53am UTC](https://discourse.julialang.org/t/transcode-string-arr-sets-the-arr-length-to-0-elements/25751/2 "2019-06-27T07:53:55Z")

</div>

This is an unfortunate consequence of calling `String` on a `Vector{UInt8}` in the implementation of `transcode`.

I agree that this is confusing. If there is no existing issue, please open one.

---

<div class="post-metadata">

### Author: ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)
#### Post date: [June 27, 2019, 1:43pm UTC](https://discourse.julialang.org/t/transcode-string-arr-sets-the-arr-length-to-0-elements/25751/3 "2019-06-27T13:43:55Z")

</div>

Already reported:

[https://github.com/JuliaLang/julia/issues/28612](https://github.com/JuliaLang/julia/issues/28612)

regards,

Sambit
