mathiasbynens / mathiasbynens/base64

Error when trying to encode Vietnamese chars

Open
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
519
Forks
98
PR merge metrics
No merged PRs in 30d

Description

Error when trying to encode Vietnamese chars

> InvalidCharacterError
> at /home/runner/invalidlatin/node_modules/base-64/base64.js:23:36
> at Object. (/home/runner/invalidlatin/node_modules/base-64/base64.js:165:2)
> at Module._compile (internal/modules/cjs/loader.js:1133:30)
> at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
> at Module.load (internal/modules/cjs/loader.js:977:32)
> at Function.Module._load (internal/modules/cjs/loader.js:877:14)
> at Module.require (internal/modules/cjs/loader.js:1019:19)
> at /home/runner/invalidlatin/index.js:1:17
> at Script.runInContext (vm.js:131:20)
>

Code
```
const base64 = require("base-64") ;

const str= "Những hình dạng của kinh tế hậu COVID-19 - Tuổi Trẻ Online";

console.log(base64.encode(str))

```

Error Example:
https://repl.it/@SoubhikChatterj/invalidlatin

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from the index.js example and inspect the stack-trace location in node_modules/base-64/base64.js. Determine the expected handling of Vietnamese characters, then add a regression test covering the reported string and verify that encoding no longer raises InvalidCharacterError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.