Post 6DKT3ZoNeah

Wesley Stump Nov 30, 2017 (23:07)

To all of the web design Eldar out there:
I have been making a Tengwar converter webpage that takes the latin script and changes the writing into the Tengwar Annatar font. I have come accross a dilemna: The only special character that doesn't seem to be read is the question mark! Here's the line of code:
if(lett == '\x3F'){
output += '\xc0';
'\x3F' is the hexadecimal code for the question mark, but when I try to run the code, it doesn't add the Á character to the variable "output". (second line) I tried replacing the "?" hex code with other strange characters, and the code works!!! If you know why this is happening, please reply!

Leonard W. Nov 30, 2017 (23:47)

Have you tried to debug your code? Single stepping should be sufficient.

Wesley Stump Dec 01, 2017 (03:36)

The code works if I insert anything into the '\x3F', and the code works everywhere else. I don't use any other functions that deal with this hex code.

Wesley Stump Dec 01, 2017 (04:01)

But I think you're right. There must be a small coincidence that creates an error when one puts in the "?"

Severin Zahler Dec 05, 2017 (01:43)

What programming language are you using? In all languages I was using I would not have to specially encode characters, usually '?' does the trick.

Edit: in '\xc0' you used a small letter c, maybe try a small letter in '\x3f'

Wesley Stump Dec 05, 2017 (13:33)

Im using javascript. And x3f is needed because that is the hex code for a "?"

Wesley Stump Dec 05, 2017 (13:34)


Severin Zahler Dec 06, 2017 (00:02)

Alright, so I am having a website I am currently building and I quickly abused it to make some tests on this matter.

Check this out: - - Startseite

The code behind is:

As you can see, all sorts of comparisons equal true. You don't need to encode the characters into hex, maybe if your file is not supporting UTF-8 you may need to do it for the non-ASCII characters, but it does not seem to be necessary. One thing I found is to preferrably use === over == to avoid some unwanted behaviour.

Wesley Stump Dec 06, 2017 (01:36)

Thank you! I will try that out!!!