unicode:encoding_to_bom/1
从编码里生成一个二进制的 UTF 字节顺序标记
用法:
encoding_to_bom(InEncoding) -> Bin
内部实现:
-spec encoding_to_bom(InEncoding) -> Bin when Bin :: binary(), InEncoding :: encoding(). encoding_to_bom(unicode) -> <<239,187,191>>; encoding_to_bom(utf8) -> <<239,187,191>>; encoding_to_bom(utf16) -> <<254,255>>; encoding_to_bom({utf16,big}) -> <<254,255>>; encoding_to_bom({utf16,little}) -> <<255,254>>; encoding_to_bom(utf32) -> <<0,0,254,255>>; encoding_to_bom({utf32,big}) -> <<0,0,254,255>>; encoding_to_bom({utf32,little}) -> <<255,254,0,0>>; encoding_to_bom(latin1) -> <<>>.
从输入编码 InEncoding 里生成一个二进制的 UTF 字节顺序标记
unicode:encoding_to_bom(unicode).
unicode:encoding_to_bom(utf8).
unicode:encoding_to_bom(utf16).
unicode:encoding_to_bom({utf16,big}).
unicode:encoding_to_bom({utf16,little}).
unicode:encoding_to_bom(utf32).
unicode:encoding_to_bom({utf32,big}).
unicode:encoding_to_bom({utf32,little}).
unicode:encoding_to_bom(latin1).