fix:iconv failed

This commit is contained in:
U-JOHNLIU\jonhl 2022-03-22 10:25:20 +08:00
parent 6c0561d858
commit 83bdf7dbae

View File

@ -18,7 +18,7 @@
%%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%%% THE SOFTWARE.
-module(dgiot_iconverl).
-module(iconverl).
-on_load(load_nif/0).
@ -57,6 +57,6 @@ load_nif() ->
end.
test() ->
{ok, M} = iconverl:conv("gbk", "utf-8", unicode:characters_to_binary(<<"在线"/utf8>>)),
{ok, DevAddr} = iconverl:conv("utf-8", "gbk", M),
io:format("DevAddr ~p ",[ unicode:characters_to_binary(DevAddr)]).
{ok, M} = conv("gbk", "utf-8", unicode:characters_to_binary(<<"在线"/utf8>>)),
{ok, DevAddr} = conv("utf-8", "gbk", M),
io:format("DevAddr ~p ",[ unicode:characters_to_list(DevAddr)]).