Forums > MaxMSP

key, atoi, itoa bug or feature?


April 24, 2008 | 7:21 pm

April 24, 2008 | 7:52 pm

On Apr 24, 2008, at 12:21 PM, Stefan Tiedje wrote:
> The main goal I want to achieve is to turn all big letters into small
> ones btw… (the regexperts could chime in on that I guess…)

I would just brute-force it and lookup the characters through a coll.

Chris Muir
cbm@well.com
http://www.xfade.com

April 25, 2008 | 8:48 am

Chris Muir schrieb:
> I would just brute-force it and lookup the characters through a coll.

Fortunately its easier as that, they are all 32 apart, and in a block of
several. I just took 192-222 in addition to 65-90…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
— _|_)—-|—–()————–
———-()——–www.ccmix.com

April 25, 2008 | 8:58 am

Stefan Tiedje schrieb:
> The main goal I want to achieve is to turn all big letters into small
> ones btw… (the regexperts could chime in on that I guess…)

as that little problem is solved, I’d still want to point out, that i
think itoa should convert all my single number ascii keys…
Now the main goal is to get it fixed, I am sure not only I will need it
in the future…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
— _|_)—-|—–()————–
———-()——–www.ccmix.com

June 12, 2009 | 10:06 am

I have the same kind of problem :

if I hit the "é" key on my (french) keyboard, the key objects returns ascii code 233, and if I send 233 to itoa,… it just outputs nothing (or "space", or anything I can’t see..)

atoi told me that the correct code for "é" is "195 169"

so : how am I supposed to convert the ascii output of key to a 2 digit value that itoa will translate corectly to a letter with accent ?

– Pasted Max Patch, click to expand. –

I know it has something to do with UTF encoding…
this problem has already been reported in several posts, but I couldn’t find a solution.
Of course I could use a coll to translate manually key output to the letters with accent… but I’m very surprise that there is no more simple solution.
(all of it used to work fine in max 4..)

any clue ?

Mathieu


Ch
June 12, 2009 | 10:47 am

Hi,

a small asciiToUTF8 :

– Pasted Max Patch, click to expand. –

I just did it, and haven’t tested it a lot…
but it seems to be ok.
Ch.

edit : added toUpperCase and toLowerCase

June 12, 2009 | 2:05 pm

nice !
it seems to work fine.
thanks !

don’t you think this kind of thing should be in the help patch of key or atoi ? or even better.. built in the key object itself ?…

Mathieu

September 13, 2012 | 3:48 pm

I’ve met the same problem three years later so I second Mathieu’s idea, at least in the help file as I’ve got no idea about what that can imply to include it in an object.

Viewing 8 posts - 1 through 8 (of 8 total)

Forums > MaxMSP