Skip to content

Specific Chinese words in username of session token caused error #217

@webbipage

Description

@webbipage

Environment:
Server: Nakama 3.35.1 with Lua runtime
Client: Nakama JavaScript SDK 2.8.0

Reproduce:

  1. User register with username including Chinese wording "真" and the word count of username > 2 (e.g. "真true").
  2. (Optional) Encode the username to UTF8 string by using JS encodeURIComponent, set the encoded as username and call authenticateEmail or authenticateDevice via Nakama JS SDK.
  3. (Optional) Decode the username in before hook of "authenticate" function in Lua runtime, for storing not UTF8 string into the Server
  4. (Optional) Encode the username back to UTF8 string in after hook of "authenticate" function in Lua runtime, prepare to send it back to the Client
  5. Receiving the response of client.authenticateEmail or client.authenticateDevice with error "Bad control character in string literal in JSON at position 105 (line 1 column 106)"

Note:

  1. The user is created successfully in Server.
  2. Tried to investigate the response with no Chinese words, or with other "no problem" Chinese words. The authenticate function of JS SDK is returning session.username in "not encoded" version. Which means the encoding username function in after hook of "authenticate" function in Lua runtime is meaningless.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions