+ 14
HTML - hexa conversion
I want that in my source code, I write something in hexa, but when we are watching the page, what was hexa is text. How can I do ?
12 odpowiedzi
+ 11
Just convert text element to &#(hexadecimal code);
https://code.sololearn.com/WwA7A95aL3W3/?ref=app
+ 9
Calviղ Thx. I also want to learn that.
+ 9
You could use this tool to do conversion
https://code.sololearn.com/WfMfIbPM9OXG/?ref=app
+ 8
To Calviղ s answer I ll add 2 more things.
1. We can use html entities both in decimal and hexadecimal format.
so in an html page,
a will give 'a' , its decimal and
a will also give 'a', its hexadecimal
but since you said hex, hence here s slightly modified example from Calviղ s Code
return '&#x' + c.codePointAt(0).toString(16) + ";"
2. If you also wish to include emojis in ur text or any other exotic character then charCodeAt() will not work,
its always best to use the newer codePointAt() method, unless performance is an issue.
https://code.sololearn.com/WH47x19QJ717/?ref=app
+ 8
https://code.sololearn.com/WQyEL6o237qO/?ref=app
+ 8
thanks guys.
I have also learnt something 👍
+ 7
You are right for non English contents. As long as the contents is in English text we still use ascii, single byte, except symbols.
+ 6
yes, but ASCII is now replaced by Unicode, so if I can I try to do not use ascii ^^
+ 5
The converter can be used for Unicode conversion as well, give it again.
+ 4
yes
+ 2
Calviղ very nice code
+ 2
I did same than you Daniil Datsenko, do a special post for this plz, and delete your comment thanks