AtomVM icon indicating copy to clipboard operation
AtomVM copied to clipboard

`iolist_size/1` and `iolist_to_binary/1` should badarg with lists of unicode characters

Open pguyot opened this issue 9 months ago • 0 comments

With BEAM:

1> iolist_to_binary("アトム").
** exception error: bad argument
     in function  iolist_to_binary/1
        called as iolist_to_binary([12450,12488,12512])
        *** argument 1: not an iodata term
2> iolist_size("アトム").
** exception error: bad argument
     in function  iolist_size/1
        called as iolist_size([12450,12488,12512])
        *** argument 1: not an iodata term

With AtomVM:

-module(iolist_test).

-export([start/0]).

start() ->
    X = iolist_to_binary("アトム"),
    Y = iolist_size("アトム"),
    erlang:display({X, Y}),
    ok.

will output:

{<<162,200,224>>,3}
Return value: ok

pguyot avatar Apr 12 '25 16:04 pguyot