Skip to content

How do I read a UTF-8 character? #45

@chandlerkent

Description

@chandlerkent

I have binary data that looks like the following:

Originally, my typeSet looked like this:

var typeSet = {
    'jBinary.all': 'BBoxes',
    'jBinary.littleEndian': true,

    BBox: {
        character: ['char'],
        x0: ['float32'],
        y0: ['float32'],
        x1: ['float32'],
        y1: ['float32'],
        x2: ['float32'],
        y2: ['float32']
    },

    BBoxes: ['array', 'BBox']
};

This works beautifully for the majority of my data. However, some of the characters are not a single byte (for example, the copyright symbol).

Is there a supported way to read a UTF-8 character, consuming as many bytes as needed to read that character?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions