utf8 is the default encoding for decoder, no need to explicitly define it
This commit is contained in:
parent
f6d980493f
commit
7fbb29369b
2 changed files with 11 additions and 8 deletions
|
@ -125,37 +125,42 @@ decoder(Opts) ->
|
|||
).
|
||||
|
||||
|
||||
%% partial codepoint max size differs across encodings
|
||||
-ifdef(utf8).
|
||||
-define(encoding, utf8).
|
||||
-define(utfx, utf8).
|
||||
-define(partial_codepoint(Bin), byte_size(Bin) < 1).
|
||||
-endif.
|
||||
%% utf8 is the default encoding
|
||||
-define(utf8, true).
|
||||
|
||||
-ifdef(utf16).
|
||||
-undef(utf8).
|
||||
-define(encoding, utf16).
|
||||
-define(utfx, utf16).
|
||||
-define(partial_codepoint(Bin), byte_size(Bin) < 2).
|
||||
-endif.
|
||||
|
||||
-ifdef(utf16le).
|
||||
-undef(utf8).
|
||||
-define(encoding, utf16le).
|
||||
-define(utfx, utf16-little).
|
||||
-define(partial_codepoint(Bin), byte_size(Bin) < 2).
|
||||
-endif.
|
||||
|
||||
-ifdef(utf32).
|
||||
-undef(utf8).
|
||||
-define(encoding, utf32).
|
||||
-define(utfx, utf32).
|
||||
-define(partial_codepoint(Bin), byte_size(Bin) < 4).
|
||||
-endif.
|
||||
|
||||
-ifdef(utf32le).
|
||||
-undef(utf8).
|
||||
-define(encoding, utf32le).
|
||||
-define(utfx, utf32-little).
|
||||
-define(partial_codepoint(Bin), byte_size(Bin) < 4).
|
||||
-endif.
|
||||
|
||||
-ifdef(utf8).
|
||||
-define(encoding, utf8).
|
||||
-define(utfx, utf8).
|
||||
-define(partial_codepoint(Bin), byte_size(Bin) < 1).
|
||||
-endif.
|
||||
|
||||
%% when parsing strings, the naive detection of partial codepoints is
|
||||
%% insufficient. this incredibly anal function should detect all badly formed
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
-module(jsx_utf8).
|
||||
|
||||
-define(utf8, true).
|
||||
|
||||
-include("../include/jsx_common.hrl").
|
||||
-include("../include/jsx_decoder.hrl").
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue