Comments (1)
My PR #1087 will fix this if merged โ it adds more conversion options to the text-to-unicode
tool. One of those options is UTF-16 Code Units, of which ๐ฏ
โ \uD83D\uDCAF
is an example.
it-tools/src/tools/text-to-unicode/text-to-unicode.service.test.ts
Lines 91 to 102 in 7e90365
Note that it isn't accurate to call this "JSON Unicode", as the best* way of encoding ๐ฏ
in JSON is as a literal ๐ฏ
Unicode character. For example, JavaScript's JSON.stringify
just uses the literal characters where possible, and JSON.parse
accepts them with no problem:
JSON.stringify({ '๐ฏ': '๐ฏ' })
// result: '{"๐ฏ":"๐ฏ"}'
JSON.parse('{"๐ฏ":"๐ฏ"}')
// result: { '๐ฏ': '๐ฏ' }
Meanwhile, encoding it as a surrogate pair may yield correct results when parsed:
JSON.parse(String.raw`{"\uD83D\uDCAF":"\uD83D\uDCAF"}`)
// result: { '๐ฏ': '๐ฏ' }
But the JSON spec doesn't require that parsers convert the surrogate pair to its corresponding code point, so it's not guaranteed that even fully spec-compliant parsers will "do the right thing" here.
*For most use cases. If you can't guarantee that the consumer will use UTF-8 as required by RFC 8259, but you can guarantee that the consumer will handle surrogate pairs correctly, then it'd make sense to use the surrogate pair. But that seems like a pretty niche situation.
from it-tools.
Related Issues (20)
- Longer JSON will cause the styles to stretch out indefinitely, making the results difficult to see HOT 1
- Maybe add a tool for vmess to clash
- Kelvin temperature can't be negative
- Add example code in JSON to CSV
- [NEW TOOL] Mac Address Converter HOT 1
- Add pasting feature when need to upload file in base64 file converter
- Token Generator text box autosize not working
- SM2, SM3, and SM4
- Make the Docker Run to Docker-Compose bidirectional (or add Docker-Compose to Docker Run tool) HOT 2
- Byte conversion tool
- Time conversion
- Build faild HOT 1
- ๆฏๅฆๅฏไปฅๆฏๆ json ่ฝฌ java ๅฎไฝ HOT 3
- Emoji: search function lags HOT 3
- Consider Slim(Toolkit) to reduce the size of the container image
- Properties่ฝฌYAML HOT 1
- Hope to add the function of converting integers to IPv4 addresses
- an API HOT 1
- how to modify the default language? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from it-tools.