strings: transcode(String, ::Vector{UInt8}) no longer empties the input (#62040)
`transcode(String, src)` for a `Vector{UInt8}` calls
`String(transcode(UInt8, src))`. `transcode(UInt8, src)` returns `src`
unchanged (identity dispatch), and `String(::Vector{UInt8})` takes
ownership and zeroes it — so the call silently empties the caller's
vector:
```julia
julia> v = collect(codeunits("hello"));
julia> transcode(String, v)
"hello"
julia> v
UInt8[]
```
Capture the intermediate buffer and copy only when it aliases the input:
```julia
b = transcode(UInt8, src)
b === src ? String(copy(b)) : String(b)
```
`String(::Vector{UInt8})` is the only constructor that truncates its
argument, and the identity dispatch only returns `src` for
`Vector{UInt8}` among the inputs `String()` would steal. Fresh buffers
(the `UInt16`/`UInt32` paths) still move without a copy.
Fixes #28612
---
This PR was done with the assistance of gen AI.
---------
Co-authored-by: Claude <noreply@anthropic.com>