Skip to content

UTF8 encoding problem #52

Closed
Closed
@MilosStanic

Description

@MilosStanic

I have implemented into my project the code from your example at https://github.com/auth0/angular-token-auth/

However, if the payload contains an UTF8 character, in my case 'ć' the payload is badly encoded, and I get an error when doing a JSON.parse of the payload, like I described here auth0-blog/angular-token-auth#9

Activity

brianloveswords

brianloveswords commented on Jan 31, 2015

@brianloveswords

This was an issue in node-jws, I was using binary as the default encoding with no option to override. I just released v2.0.0 which changes the default to utf8 and gives the option to override the encoding.

robertu7

robertu7 commented on Mar 2, 2015

@robertu7

Same problem with @MilosStanic , see below code:

var token = jwt.sign({
    username: '測試'
 }, key)

then when:

jwt.verify(token, key)

with error Unexpected token at JSON.parse.

robertu7

robertu7 commented on Mar 2, 2015

@robertu7

@brianloveswords Awesome! 👍

jfromaniello

jfromaniello commented on Mar 6, 2015

@jfromaniello
Member

It will be fixed on v4. Thank you guys!

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @brianloveswords@jfromaniello@MilosStanic@robertu7

        Issue actions

          UTF8 encoding problem · Issue #52 · auth0/node-jsonwebtoken