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

Fix for #68846 #1092

Closed
wants to merge 4 commits into from

Conversation

3 participants
@masakielastic
Copy link
Contributor

commented Feb 18, 2015

mbstring miscaliculate the codepoint when converting string from GB18030 to UTF-32. This pull request add missing missing parentheses.

// http://icu-project.org/docs/papers/gb18030.html#h7
// uFirst = 0x10000;
// bFirst = [0x90, 0x30, 0x81, 0x30];

int linear(byte bytes[4]) {
    return ((bytes[0]*10+bytes[1])*126+bytes[2])*10+bytes[3];
}

 int mapToUnicode(byte bytes[4]) {
    int lin=linear(bytes);
    for each range {
        if(linear(bFirst)<=lin&lt=linear(bLast)) {
            // range found
            return uFirst+(lin-linear(bFirst));
        }
    }
    // the byte sequence is not in any known range
    return error;
}

@jpauli jpauli added the Bugfix label Feb 19, 2015

@smalyshev

This comment has been minimized.

Copy link
Contributor

commented Mar 9, 2015

merged

@smalyshev smalyshev closed this Mar 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.