JSON-DWIW
view release on metacpan or search on metacpan
libjsonevt/jsonevt.c view on Meta::CPAN
JSONEVT_INLINE_FUNC uint
jsonevt_get_line_num(jsonevt_ctx * ctx) {
return CUR_LINE(ctx);
}
*/
static int
check_bom(json_context * ctx) {
uint len = ctx->len;
const char * buf = ctx->buf;
char * error_fmt = "found BOM for unsupported %s encoding -- this parser requires UTF-8";
/* check for UTF BOM signature */
/* The signature, if present, is the U+FEFF character encoded the
same as the rest of the buffer.
See <http://www.unicode.org/unicode/faq/utf_bom.html#25>.
*/
if (len >= 1) {
switch (*buf) {
case '\xEF': /* maybe utf-8 */
if (len >= 3 && MEM_EQ(buf, "\xEF\xBB\xBF", 3)) {
/* UTF-8 signature */
libjsonevt/uni.h view on Meta::CPAN
#define UNI_DO_CPLUSPLUS_WRAP_END
#endif
UNI_DO_CPLUSPLUS_WRAP_BEGIN
/* if the only set bits are in the lower 7, then the byte sequence in utf-8 is the same as ascii */
#define UNICODE_IS_INVARIANT(v) (((uint32_t)v) < 0x80)
/* the byte order mark is the code point 0xFEFF */
/* encoded as utf-8: "\xef\xbb\xbf" */
#define UNICODE_IS_BOM(v) ((v) == 0xFEFF);
UNI_DO_CPLUSPLUS_WRAP_END
#endif /* UNI_H */
( run in 0.369 second using v1.01-cache-2.11-cpan-e9daa2b36ef )