Skip to content

Error encoding #20

Description

@sin-raben

In the module "node-dbf" there is the following problem:
the encoding with large files,

buffer = overflow + buffer //return string utf-8

replace

buffer = Buffer.concat([overflow,buffer], buffer.length + overflow.length); //return buffer

fields, records "N" may be not integer ("N 15 3"),
when processing fields of type "F" is equal to 0 it returns NaN.

value = +value; //for field.type 'F','N' (standard no leading zeros)

I would also like to ask to add the ability to specify the decoding function of string

value = (buffer.toString @encoding).trim()

replace

if (this.encodingFunction) {
    value = (this.encodingFunction(buffer)).trim();
} else {
    value = (buffer.toString(this.encoding)).trim();
}

and add type the date

if (field.type === 'D') {
    value = new Date(+value.slice(0,4), +value.slice(4,6), +value.slice(6,8));
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions