We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › How do I use UTF-8
Page Index Toggle Pages: 1
How do I use UTF-8? (Read 1067 times)
How do I use UTF-8?
Jan 30th, 2006, 3:11am
 
Hi I'm doing a processing application and I never manage to get non ascii characters on the input. the example: Examples/Data/CharacterStrings/ will not print the üûä characers for me, when I press them on my keyboard.

Anyone knows how to accept 8bit data?
Re: How do I use UTF-8?
Reply #1 - Jan 30th, 2006, 1:55pm
 
Ok I have tested some more and I would really like some feedback, because sometimes I get the the unicode values for åäö but not always like something like every tenth time.

I've replaced the keyPressed original code with this:

void keyPressed()
{
   letter = char(key);
   float scale = 100.0/57.0;
   int temp = int((key - 'A') * scale);
   xoffset = temp;
   println("Unicode?: "+ key);
}
Re: How do I use UTF-8?
Reply #2 - Feb 18th, 2006, 9:33pm
 
key should always be a unicode char, or the constant CODED if it's a coded key (like when you hit CTRL or OPTION or ALT).

the scale/temp/xoffset stuff is gonna be weird because the unicode values can be way out of range, and subtracting 'A' from the value doesn't make much sense with unicode values.
Re: How do I use UTF-8?
Reply #3 - Mar 15th, 2006, 2:41pm
 
fry wrote on Feb 18th, 2006, 9:33pm:
key should always be a unicode char, or the constant CODED if it's a coded key (like when you hit CTRL or OPTION or ALT).


Can you confirm that you get that unicode chars from Processing because I'm not getting any..


Code:

void keyPressed()
{
letter = char(key);
println("Unicode?: "+ key " char:"+ letter +"end");
}

Re: How do I use UTF-8?
Reply #4 - Mar 15th, 2006, 3:32pm
 
yes, i'm getting unicode chars.
Page Index Toggle Pages: 1