NLF
Replacing ">" and "<" with Unicode code point for. json encoding
Hello everyone after few hours of looking at docs and googling I still can’t for the love of me figure out how to mirror the json_encode in PHP json_encode with JSON_HEX_TAG which according to documentation here convert
All < and > are converted to \u003C and \u003E.
I know that using Jason_encode with the escape: :html_safe tag will will convert the ‘<’ with the proper unicode but NOT ‘>’.
What’s the most convenient way to fix this?
Thanks! ![]()
Most Liked
03juan
Welcome to the forum ![]()
There is an open issue about this from 20d ago, and it definitely seems like a bug. html_safe encoding bug · Issue #151 · michalmuskala/jason · GitHub
This line in the code jason/lib/encode.ex at master · michalmuskala/jason · GitHub is where the angle brackets should be encoded, and < is absent.
html_ranges = [{0x00..0x1F, :unicode}, {?<, :unicode}, {?/, ?/} | slash_escapes]
Last Post!
03juan
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









