key, atoi, itoa bug or feature?

Stefan Tiedje's icon
Chris Muir's icon

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

Stefan Tiedje's icon

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

Stefan Tiedje's icon

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

Mathieu Chamagne's icon

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 ?

Max Patch
Copy patch and select New From Clipboard in Max.

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's icon

Hi,

a small asciiToUTF8 :

Max Patch
Copy patch and select New From Clipboard in Max.

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

edit : added toUpperCase and toLowerCase

Mathieu Chamagne's icon

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

Stephane Morisse's icon

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.