This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
jag's profile picture

Åäö Support Already Exists!

Started by jag, 14 September 2013 - 04:59 AM
jag #1
Posted 14 September 2013 - 06:59 AM
I posted this here earlier, but wanted to bring it up in its own post.
I do not know if this subject already exists but I will post it anyways.

I have noticed that åäö åäö is kinda supported (as well as other misc. symbols), but they are special.

In the shell program if you type å then you will notice that it actually wrote it out. But if you add another symbol after it turns into question marks.
Another note is that if you type å then you can move your cursor another step to the right, despite its only 1 character long.

This is because these characters are multiple "symbols" of data. So when you type a single å, you can set your cursor 1 step to the right of the letter.
The # operator and the string.len() shows how many "data symbols" there are, and because å is made out of 2 different data symbols it acts as it does.

Example:


And why it becomes question marks is because you are putting more symbols in the middle of the existing one. And this weird combo symbol you've created doesn't got a sign for it so it shows up as question marks.

It even says it's 2 symbols (kinda) at this ASCII table at http://www.ascii-code.com/

Small letter A with ring above.
one's the a, the other's the ring. (it's not exactly like this, but its very similar.)




string.byte()

So if you don't get whats happening here, let me show you this:



From http://www.ascii-code.com/

Simple:
a = 97
b = 98
c = 99

But!
å = 195 & 165
å is made by putting together à and ¥.
å ≈ Ã¥

Now that isn't paste'able in the ComputerCraft computers, but you could just paste å, basically the same thing. :)/>

The fix:
Now I have not found a existing fix for this, yet!



I got an idea of what you could do, basically replace all the special symbols with something short like X or something, and then get the length of that one.
It would be impressing to include åäö support in your program while everybody else on the forum doesn't, I do not know if I should make my own post of this, but I do not know if someone got the fix already.

Since some symbols cant even be pasted it would not be too big of a task to make such a system. Just sayin' it's possible.
oeed #2
Posted 14 September 2013 - 07:15 AM
Cool, are there any other special characters inaddition to these (for icons, etc)?
diegodan1893 #3
Posted 14 September 2013 - 09:17 AM
If you code on a external editor you can add chars like (ñ, á…) and it would work fine. But the problem is that it won't work with HTTP API, so if you upload the program to pastebin, CC will change all special characters to '?'.

Maybe ask the users the first time they run the program to write all special characters?
Symmetryc #4
Posted 14 September 2013 - 11:44 AM
I remember awhile ago someone posted about the same thing, showing that there was a second parameter to string.char that helped with this kind of stuff and even made things like "½" possible, but I'm not sure where that post is now :/.

Cool, are there any other special characters inaddition to these (for icons, etc)?

There's string.char(166) which gives you an arrow that I haven't seen used too much before. It should be noted though that this isn't one of these combo glyph special characters, this is just a single glyph character that is untypable on the keyboard so many people haven't used it before.
jag #5
Posted 14 September 2013 - 02:25 PM
If you code on a external editor you can add chars like (ñ, á…) and it would work fine. But the problem is that it won't work with HTTP API, so if you upload the program to pastebin, CC will change all special characters to '?'.

Maybe ask the users the first time they run the program to write all special characters?

It could be http or pastebin that's doing it, not comoutercraft.
So if you wish to make a nifty mail system with åäö support for example, I think you also have to add a way to convert the special characters, similarly to the textutils.serialize() function.
jag #6
Posted 14 September 2013 - 02:26 PM
–snip–

There's string.char(166) which gives you an arrow that I haven't seen used too much before. It should be noted though that this isn't one of these combo glyph special characters, this is just a single glyph character that is untypable on the keyboard so many people haven't used it before.

Is this possible in CC? If so then this could revolutionize a lot of programs!
Symmetryc #7
Posted 14 September 2013 - 02:43 PM
–snip–

There's string.char(166) which gives you an arrow that I haven't seen used too much before. It should be noted though that this isn't one of these combo glyph special characters, this is just a single glyph character that is untypable on the keyboard so many people haven't used it before.

Is this possible in CC? If so then this could revolutionize a lot of programs!
The arrow? Yeah, it's possible. Try doing

print(string.char(166))
It will print it out.
jag #8
Posted 14 September 2013 - 06:56 PM
The arrow? Yeah, it's possible. Try doing

print(string.char(166))
It will print it out.

Awesome!