key, atoi, itoa bug or feature?

Apr 24, 2008 at 7:21pm

key, atoi, itoa bug or feature?

#37194
Apr 24, 2008 at 7:52pm

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

#128302
Apr 25, 2008 at 8:48am

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

#128303
Apr 25, 2008 at 8:58am

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

#128304
Jun 12, 2009 at 10:06am

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

#128305
Jun 12, 2009 at 10:47am

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

#128306
Jun 12, 2009 at 2:05pm

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

#128307
Sep 13, 2012 at 3:48pm

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.

#128308

You must be logged in to reply to this topic.