erlang转化中文为url

今天使用http get 方法时,参量中有中文而致使出错。app

例如http://abc.com/abc?arg=中文,在erlang使用http:request方法失败。post

后来查了url的规范,url中要使用ascii字符,从而写了下面的方法:url

lists:append([io_lib:format("%~.16B", [E]) || E <- binary_to_list(unicode:characters_to_binary("中文"))])。

上面转化的字符追加到url末尾就能够了。code

使用post方法能够参考:orm

how to support chinese in http request body? erlangblog

相关文章
相关标签/搜索