Jump to content




Åäö Support Already Exists!

computer

7 replies to this topic

#1 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 14 September 2013 - 05: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:
Posted Image

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/

Quote

Posted Image
Posted Image
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.)


Posted Image

string.byte()

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

Quote

Posted Image
Posted Image
Posted Image
Posted Image
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!

Posted Image

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.

#2 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 14 September 2013 - 06:15 AM

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

#3 diegodan1893

  • Members
  • 164 posts
  • LocationSpain

Posted 14 September 2013 - 08: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?

#4 Symmetryc

  • Members
  • 434 posts

Posted 14 September 2013 - 10: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 :/.

View Postoeed, on 14 September 2013 - 06:15 AM, said:

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.

#5 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 14 September 2013 - 01:25 PM

View Postdiegodan1893, on 14 September 2013 - 08:17 AM, said:

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.

#6 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 14 September 2013 - 01:26 PM

View PostSymmetryc, on 14 September 2013 - 10:44 AM, said:

--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!

#7 Symmetryc

  • Members
  • 434 posts

Posted 14 September 2013 - 01:43 PM

View PostakaJag, on 14 September 2013 - 01:26 PM, said:

View PostSymmetryc, on 14 September 2013 - 10:44 AM, said:

--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.

#8 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 14 September 2013 - 05:56 PM

View PostSymmetryc, on 14 September 2013 - 01:43 PM, said:

The arrow? Yeah, it's possible. Try doing
print(string.char(166))
It will print it out.

Awesome!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users