Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem to get header content! #222

Open
dangdkhanh opened this issue Apr 3, 2024 · 1 comment
Open

Problem to get header content! #222

dangdkhanh opened this issue Apr 3, 2024 · 1 comment

Comments

@dangdkhanh
Copy link

Hi,

Please check the attached file.
The separator character is tab.
The third column header returns the wrong content.
Thanks you.

B.TXT

@dangdkhanh dangdkhanh changed the title Add support unicode for header! Problem to get header content! Apr 3, 2024
@dangdkhanh
Copy link
Author

Hi,
I realized the problem lies with the unicode characters that are at the beginning or end of each cell. will cause field_start and field_length calculations to be incorrect.
The temporary way I came up with is to use a variable that defines the boundary:

const BOOL checkboundary(char x) {
return x == '\t' || x == ',';
};
const auto& isbeginend = data_pos == 0 || (data_pos > 1 &&
((!checkboundary(this->data_ptr->data[data_pos]) && checkboundary(this->data_ptr->data[data_pos - 1])) ||
(!checkboundary(this->data_ptr->data[data_pos]) && data_pos < size - 1 && checkboundary(this->data_ptr->data[data_pos + 1]))));

From there recalculate the flag:

const auto& flag = compound_parse_flag(in[data_pos], isbeginend);

It may work in some cases but not completely.
B.TXT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant