Skip to content

Maybe there is a bug for String.UTF8.encode and String.UTF8.decode #2021

Closed
@victortanjh

Description

@victortanjh

my test function is :
function putData():void{
let buf1 = String.UTF8.encode("bench_key_10000",true)
let str1 = String.UTF8.decode(buf1)
let buf2 = String.UTF8.encode(" the arg is " + str1, true);
}
when executing this function ,then it will crash.
if I change this function to be:
function putData():void{
let buf1 = String.UTF8.encode("bench_key_9999",true)
let str1 = String.UTF8.decode(buf1)
let buf2 = String.UTF8.encode(" the arg is " + str1, true);
}
or change it to be:
function putData():void{
let buf1 = String.UTF8.encode("bench_key_10000",true)
let str1 = String.UTF8.decode(buf1, true)
let buf2 = String.UTF8.encode(" the arg is " + str1, true);
}
it will not crash.

But I do not know why.

Can anyone explain this phenomenon? Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions