I am trying to create some random unicode strings within javascript and was wondering if there was an easy way. I tried doing something like this…
var username = "David Perry" + "/u4589";
But it just appends /u4589 to the end which is to be expected since it’s just a string. What I WANT it to do is convert that into the unicode character in the string (AS IF I typed ALT 4589 on the keypad). I’m trying to build the string within javascript because I wanna test my form with various symbols and stuff and I’m tired of trying ALT codes to see what weird characters there are… so I thought.. I would loop through ALL unicode characters for FUN and populate my form and submit it automatically…
I was going to start at /u0000 and go up to /uffff and see which codes break my website when outputting them 🙂
I know there are different functions in JS but I can’t seem to figure out why I can’t build a string of unicode characters. lol.
If it’s too complicated don’t worry about it. It’s just something I wanted to tinker with.
Try
"\u4589"instead of"/u4589":the forward slash (
/) is just a forward slash in a string, however the backslash (\) is an escape character.