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 btoa$1 error for non-ascii characters (such as Cyrillic) #4903

Closed
unpete opened this issue Feb 18, 2016 · 5 comments

Comments

@unpete
Copy link

commented Feb 18, 2016

function btoa$1(str) rise DOMException "The string to be encoded contains characters outside of the Latin1 range" if str contains non-ascii characters.
Replace btoa(str) to btoa(unescape(encodeURIComponent(str))) fixes this error

@daleharvey

This comment has been minimized.

Copy link
Member

commented Feb 19, 2016

Great catch, could you post any example code which highlights the issue?

@unpete

This comment has been minimized.

Copy link
Author

commented Feb 19, 2016

https://jsfiddle.net/oknosoft/dvjfzjev/

var db = new PouchDB("https://fakepath.net/", {
    auth: {
    username: "guest",
    password: "password"
    }                       
});

all ok, but:

var db = new PouchDB("https://fakepath.net/", {
    auth: {
    username: "Иванов И.И.",
    password: "Секрет"
    }                       
});

rises error

@nolanlawson

This comment has been minimized.

Copy link
Member

commented Feb 22, 2016

Could you open a PR with this change? Looks like the place to put the change would be this line of code.

@unpete

This comment has been minimized.

Copy link
Author

commented Feb 22, 2016

Probably, the change in that line of code. PR will be added after the testing.

daleharvey added a commit that referenced this issue Feb 29, 2016
daleharvey added a commit that referenced this issue Mar 1, 2016
daleharvey added a commit that referenced this issue Mar 2, 2016
@daleharvey

This comment has been minimized.

Copy link
Member

commented Mar 2, 2016

Fixed in e45e7a0

@daleharvey daleharvey closed this Mar 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.