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.

Json.stringify: how configure encoding.

See original GitHub issue
val telemetryData = Json.stringify(
            TelemetryData.serializer(),
            TelemetryData(
                "Русский язык ТЕСТ", // ← this have problem with encoding
                LocalDateTime.now().toString(),
                project.name,
                TemporaryData.sourcesDirectory,
                TemporaryData.editedFileDataList
            )
        )

after println(telemetryData) i have {"user":"??????? ???? ????"...

library name version
kotlinx serialization runtime 0.11.0
kotlin serialization 1.3.30
kotlin version 1.3.30

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sandwwraithcommented, Apr 29, 2019

I doubt that this is a library problem, it’s rather your console/environment printing them incorrectly. Printing to file may help.

0reactions
MairwunNxcommented, Apr 29, 2019

It incorrectly encoding caused “???”, but it also send to server \ save to file with “???”. but debugger show good result as need.

How do I solve the problem - I will describe the solution here. It would be not cultural to leave without leaving an answer 😃

Thanks, please mark it issue as false problem.

UPD: Currently problem not solved, but most likely a problem with the coding console

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON.stringify() to UTF-8 - javascript - Stack Overflow
So, yes, JSON.stringify() will return a string in whatever encoding your implementation uses for strings. If you were to find a way to...
Read more >
JSON.stringify() - JavaScript - MDN Web Docs
The JSON.stringify() method converts a JavaScript value to a JSON string, ... Before this change, such strings could not be encoded in valid ......
Read more >
Encoding JSON - Haxe - The Cross-platform Toolkit
Json.stringify static method to encode a Haxe value into a JSON string: class Main { static function main() { var o = {rating:...
Read more >
How to decode and encode JSON Data in JavaScript
How to decode and encode JSON data in JavaScript. You will learn how to encode and decode JSON data in JavaScript with the...
Read more >
JSON and the stringification oddities in JavaScript - Zhenghao
What we have discussed so far is the default behaviour of how JavaScript encodes values into JSON strings via JSON.stringify .
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