question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Encoding error while parsing cyrillic text fields

See original GitHub issue

Support plan

Hello! I found an error while parsing form fields for utf-8 cyrillic. The error lies in the incorrect encoding of text fields.

<html>

<head>
    <meta charset="utf-8">
</head>
Hello World!...Cyrillic encoding error
<br>
<form method="post" enctype="multipart/form-data">
    <input type="text" name="text" value="абвгд кириллица алфавит" />
    <input type="submit" name="submit" value="submit" />
</form>

</html>
app.post("/", function(req, res) {
  const form = formidable({ multiples: true });
  form.parse(req, (err, fields, files) => {
    console.log(fields);
  });
  res.end();
});

What was the result you got?

Erroneous result of form parsing:

{ text: 'абвгд киÑиллиÑа Ð°Ð»Ñ Ð°Ð²Ð¸Ñ', submit: 'submit' }

What result did you expect?

Expected Result:

{ text: 'абвгд кириллица алфавит', submit: 'submit' }

I created a test to repeat the error on the code sandbox. https://codesandbox.io/s/simple-express-server-rcwvm?file=/src/index.js:834-1248

Context

  • node version: v10.20.1
  • module (formidable) version: ^2.0.0
  • used with express

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tunnckoCorecommented, May 4, 2020

Published formidable@2.0.0-canary.20200504.1, which includes couple of other things since last published canary.

0reactions
yuriyantcommented, May 5, 2020

Thank you very much! Great job!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve problem with parsing html file with cyrillic symbol?
I got it to work by decoding the source string - tree = html.fromstring(source.decode('utf-8')) : # -*- coding:cp1251 -*- import lxml from ...
Read more >
How To: resolve errors in Designer for non-English...
Characters with incorrect encoding will often appear as boxes or question marks in the Designer Results screen and error messages.
Read more >
3 steps to fix encoding problems in Ruby - Justin Weiss
Most encodings are small, and can't handle every possible character. You'll see that error when a character in one encoding doesn't exist in...
Read more >
Support non-Unicode character encoding in Azure Logic Apps
When you work with text payloads, Azure Logic Apps infers the text is encoded in a Unicode format, such as UTF-8.
Read more >
Processing Text Files in Python 3 - Nick Coghlan's Python Notes
Unicode Error Handlers¶ · backslashreplace : this is an encoding error handler that converts code points that can't be represented in the target...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found