java - Convert string with utf-8 to unicode -
i have string contains utf-8 encoded emojis. string escaped. need convert utf-8 emojis , print them properly. example:
input: \\xe2\\x80\\x9c@vinefights: not care lamo!!! \\xf0\\x9f\\x98\\x82 https:\\/\\/t.co\\/twmyfehx9g\\xe2\\x80\\x9d\\xf0\\x9f\\x98\\x82\\xf0 \\x9f\\x98\\xad\\xf0\\x9f\\x98\\xad expected output: not care lamo!!! 😂 url”😂ðŸ˜ðŸ˜
this 1 sinle string (without breaks). have broken down fit in 1 view in question.
idea extract emojis using regex (\\\\x[a-fa-f0-9]{2})+
, replace them converting bytes manually emojis. failed in several cases 1 in example. feels unnecessary hacky/ugly solution. what's right way handle it?
(more interested know how done in real world. examples appreciated)
Comments
Post a Comment