+ 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 ?

21st Oct 2018, 8:52 AM
NoxFly
NoxFly - avatar
12 Answers
+ 11
Just convert text element to &#(hexadecimal code); https://code.sololearn.com/WwA7A95aL3W3/?ref=app
21st Oct 2018, 9:20 AM
Calviղ
Calviղ - avatar
+ 9
Calviղ Thx. I also want to learn that.
21st Oct 2018, 11:16 AM
Arushi Singhania
Arushi Singhania - avatar
+ 9
You could use this tool to do conversion https://code.sololearn.com/WfMfIbPM9OXG/?ref=app
21st Oct 2018, 1:21 PM
Calviղ
Calviղ - avatar
+ 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
21st Oct 2018, 4:46 PM
Morpheus
Morpheus - avatar
+ 8
https://code.sololearn.com/WQyEL6o237qO/?ref=app
21st Oct 2018, 6:03 PM
Shubham goyal
Shubham goyal - avatar
+ 8
thanks guys. I have also learnt something 👍
22nd Oct 2018, 6:23 AM
Nathan 🇰🇪
Nathan 🇰🇪 - avatar
+ 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.
21st Oct 2018, 1:28 PM
Calviղ
Calviղ - avatar
+ 6
yes, but ASCII is now replaced by Unicode, so if I can I try to do not use ascii ^^
21st Oct 2018, 1:26 PM
NoxFly
NoxFly - avatar
+ 5
The converter can be used for Unicode conversion as well, give it again.
21st Oct 2018, 3:03 PM
Calviղ
Calviղ - avatar
+ 4
yes
21st Oct 2018, 1:28 PM
NoxFly
NoxFly - avatar
+ 2
Calviղ very nice code
22nd Oct 2018, 3:57 PM
Konstantinos Fuad
Konstantinos Fuad - avatar
+ 2
I did same than you Daniil Datsenko, do a special post for this plz, and delete your comment thanks
22nd Oct 2018, 8:25 PM
NoxFly
NoxFly - avatar