Re: [PHP] Re: Problem with non us caracters and "strtr"
Rodrigo Peres wrote: > I've tried the recode(), but I think I didn't uderstand it's functionality, > since nothing happens. can someone has an idea in how to convert for example > a string posted by a form in this format "são paulo" to this "sao paulo"?? recode extension may be broken currently. I saw sevral post complaining about it... I'm not sure how latin encodings (ISO-8859-*) are handled in mbstring module. You might want to try mbstring encoding conversion functions. You might also want to try iconv module, see if it helps. (Note: iconv is broken in 4.0.6) > Does anyone knows how Macintosh's browsers send this special caracteres to > PHP??? Most browsers are capable of sending data with verious character encoding (i.e. It's not Mac specific) Check your http header and meta tag in html doc at first. Browser may send data with other encoding other than you specified in HTTP header/META tag. It's server side script programmers task to make sure convert string, alert users, etc. If you want to allow only ISO-8859-1, alerting user would be esiest. -- Yasuo Ohgaki > > on 11/1/01 9:17 PM, Yasuo Ohgaki at [EMAIL PROTECTED] wrote: > > >>Rodrigo Peres wrote: >> >> >>>Hi list, >>> >>>I'm in a big trouble. I'm brazilian, so I've made a script to clean up the >>>special caracters from our language in order to not mess up my publisher, >>>but this script don't work in Macintosh (macos 9.1, IE 5, all in american >>>english). >>> >>>This is my code >>> >>> >function myclean(&$name) { >>>$name = strtolower(strtr($name, >>>"áéíóúàèìòùäëïöüâêîôûãçÁÉÍÓÚÀÈÌÒÙÄËÏÖÜÂÊÎÔÛÃÇ ", >>>"aeiouaeiouaeiouaeiouacAEIOUAEIOUAEIOUAEIOUAC")); >>>return $name; >>>} >>>$temp = myclean($name_actor); >>>echo($temp); >>>?> >>> >>>What happens is if i try for example to clean up "São Paulo" it prints "são >>>paulo". Why?? >>>The "$name" will receive a string form a text field in a form. my html >>>charset is iso-8859-1 >>> >> >>I think you are better to use recode extension for this. >>Check out recode manual page. >> >>-- >>Yasuo Ohgaki >> >> > _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Problem with non us caracters and "strtr"
Py, I've tried your method but again, didn't work, here how the word "São Paulo" appears in the url with get method "S%E3o+Paulo" and the word "zé" "z%E9", maybe there's some clue here. I'm in a macintosh sys 9.1, IE5 all in english. Thank's in advance Rodrigo on 11/2/01 1:01 PM, pierre-yves at [EMAIL PROTECTED] wrote: > Hello, > >> can someone has an idea in how to convert for example >>> a string posted by a form in this format "são paulo" to this "sao > paulo"?? > > function remove_accents( $str ){ > if( strlen( $str ) == 0 ) > return $str; > else > $ret = strtr($str, > "ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ", > "AACOYaacooyy"); > return $ret; > } > > hope it helps, > py > > - Original Message ----- > From: "Stefan Rusterholz" <[EMAIL PROTECTED]> > To: "Rodrigo Peres" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Friday, November 02, 2001 9:10 AM > Subject: Re: [PHP] Re: Problem with non us caracters and "strtr" > > >> I have little experience with this kind of problem. >> None of the Browsers I used under mac (IE 4 - 5 and sever NS 4.x) has sent >> the data different than Windows Browsers. But avoid the meta-tag charset. > I >> had serious problems when the HTML-file where the form data came from had >> that tag set (but I didn't spend a lot of time investigating it). >> >> Anyway: why do you want to translate a ã to an a? >> I made good experiences with storing original chars and using > htmlentities() >> (or otherway round if you don't have to edit that stuff) >> >> Stefan Rusterholz, [EMAIL PROTECTED] >> -- >> interaktion gmbh >> Stefan Rusterholz >> Zürichbergstrasse 17 >> 8032 Zürich >> ------------------ >> T. +41 1 253 19 55 >> F. +41 1 253 19 56 >> W3 www.interaktion.ch >> -- >> >> - Original Message - >> From: "Rodrigo Peres" <[EMAIL PROTECTED]> >> To: "Yasuo Ohgaki" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >> Sent: Friday, November 02, 2001 2:51 PM >> Subject: Re: [PHP] Re: Problem with non us caracters and "strtr" >> >> >>> I've tried the recode(), but I think I didn't uderstand it's >> functionality, >>> since nothing happens. can someone has an idea in how to convert for >> example >>> a string posted by a form in this format "são paulo" to this "sao > paulo"?? >>> Does anyone knows how Macintosh's browsers send this special caracteres > to >>> PHP??? >>> >>> Thank's again >>> >>> Rodrigo Peres >>> >>> >>> >>> >>> on 11/1/01 9:17 PM, Yasuo Ohgaki at [EMAIL PROTECTED] wrote: >>> >>>> Rodrigo Peres wrote: >>>> >>>>> Hi list, >>>>> >>>>> I'm in a big trouble. I'm brazilian, so I've made a script to clean > up >> the >>>>> special caracters from our language in order to not mess up my >> publisher, >>>>> but this script don't work in Macintosh (macos 9.1, IE 5, all in >> american >>>>> english). >>>>> >>>>> This is my code >>>>> >>>>> >>>>> >>>> function myclean(&$name) { >>>>> $name = strtolower(strtr($name, >>>>> "áéíóúàèìòùäëïöüâêîôûãçÁÉÍÓÚÀÈÌÒÙÄËÏÖÜÂÊÎÔÛÃÇ ", >>>>> "aeiouaeiouaeiouaeiouacAEIOUAEIOUAEIOUAEIOUAC")); >>>>> return $name; >>>>> } >>>>> $temp = myclean($name_actor); >>>>> echo($temp); >>>>> ?> >>>>> >>>>> What happens is if i try for example to clean up "São Paulo" it > prints >> "são >>>>> paulo". Why?? >>>>> The "$name" will receive a string form a text field in a form. my > html >>>>> charset is iso-8859-1 >>>> >>>> >>>> I think you are better to use recode extension for this. >>>> Check out recode manual page. >>>> >>>> -- >>>> Yasuo Ohgaki >>>> >>> >>> -- >>> >>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> To contact the list administrators, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> To contact the list administrators, e-mail: [EMAIL PROTECTED] >> > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Problem with non us caracters and "strtr"
Hello, > can someone has an idea in how to convert for example > > a string posted by a form in this format "são paulo" to this "sao paulo"?? function remove_accents( $str ){ if( strlen( $str ) == 0 ) return $str; else $ret = strtr($str, "ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ", "AACOYaacooyy"); return $ret; } hope it helps, py - Original Message - From: "Stefan Rusterholz" <[EMAIL PROTECTED]> To: "Rodrigo Peres" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, November 02, 2001 9:10 AM Subject: Re: [PHP] Re: Problem with non us caracters and "strtr" > I have little experience with this kind of problem. > None of the Browsers I used under mac (IE 4 - 5 and sever NS 4.x) has sent > the data different than Windows Browsers. But avoid the meta-tag charset. I > had serious problems when the HTML-file where the form data came from had > that tag set (but I didn't spend a lot of time investigating it). > > Anyway: why do you want to translate a ã to an a? > I made good experiences with storing original chars and using htmlentities() > (or otherway round if you don't have to edit that stuff) > > Stefan Rusterholz, [EMAIL PROTECTED] > -- > interaktion gmbh > Stefan Rusterholz > Zürichbergstrasse 17 > 8032 Zürich > -- > T. +41 1 253 19 55 > F. +41 1 253 19 56 > W3 www.interaktion.ch > -- > > - Original Message ----- > From: "Rodrigo Peres" <[EMAIL PROTECTED]> > To: "Yasuo Ohgaki" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, November 02, 2001 2:51 PM > Subject: Re: [PHP] Re: Problem with non us caracters and "strtr" > > > > I've tried the recode(), but I think I didn't uderstand it's > functionality, > > since nothing happens. can someone has an idea in how to convert for > example > > a string posted by a form in this format "são paulo" to this "sao paulo"?? > > Does anyone knows how Macintosh's browsers send this special caracteres to > > PHP??? > > > > Thank's again > > > > Rodrigo Peres > > > > > > > > > > on 11/1/01 9:17 PM, Yasuo Ohgaki at [EMAIL PROTECTED] wrote: > > > > > Rodrigo Peres wrote: > > > > > >> Hi list, > > >> > > >> I'm in a big trouble. I'm brazilian, so I've made a script to clean up > the > > >> special caracters from our language in order to not mess up my > publisher, > > >> but this script don't work in Macintosh (macos 9.1, IE 5, all in > american > > >> english). > > >> > > >> This is my code > > >> > > >> > > >> > >> function myclean(&$name) { > > >> $name = strtolower(strtr($name, > > >> "áéíóúàèìòùäëïöüâêîôûãçÁÉÍÓÚÀÈÌÒÙÄËÏÖÜÂÊÎÔÛÃÇ ", > > >> "aeiouaeiouaeiouaeiouacAEIOUAEIOUAEIOUAEIOUAC")); > > >> return $name; > > >> } > > >> $temp = myclean($name_actor); > > >> echo($temp); > > >> ?> > > >> > > >> What happens is if i try for example to clean up "São Paulo" it prints > "são > > >> paulo". Why?? > > >> The "$name" will receive a string form a text field in a form. my html > > >> charset is iso-8859-1 > > > > > > > > > I think you are better to use recode extension for this. > > > Check out recode manual page. > > > > > > -- > > > Yasuo Ohgaki > > > > > > > -- > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Problem with non us caracters and "strtr"
I need to transalte the chars because the system will create folder automatically, base in the name entered in this fields, so if it contains illegal chars Rodrigo on 11/2/01 11:10 AM, Stefan Rusterholz at [EMAIL PROTECTED] wrote: > I have little experience with this kind of problem. > None of the Browsers I used under mac (IE 4 - 5 and sever NS 4.x) has sent > the data different than Windows Browsers. But avoid the meta-tag charset. I > had serious problems when the HTML-file where the form data came from had > that tag set (but I didn't spend a lot of time investigating it). > > Anyway: why do you want to translate a ã to an a? > I made good experiences with storing original chars and using htmlentities() > (or otherway round if you don't have to edit that stuff) > > Stefan Rusterholz, [EMAIL PROTECTED] > -- > interaktion gmbh > Stefan Rusterholz > Zürichbergstrasse 17 > 8032 Zürich > -- > T. +41 1 253 19 55 > F. +41 1 253 19 56 > W3 www.interaktion.ch > -- > > - Original Message - > From: "Rodrigo Peres" <[EMAIL PROTECTED]> > To: "Yasuo Ohgaki" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, November 02, 2001 2:51 PM > Subject: Re: [PHP] Re: Problem with non us caracters and "strtr" > > >> I've tried the recode(), but I think I didn't uderstand it's > functionality, >> since nothing happens. can someone has an idea in how to convert for > example >> a string posted by a form in this format "são paulo" to this "sao paulo"?? >> Does anyone knows how Macintosh's browsers send this special caracteres to >> PHP??? >> >> Thank's again >> >> Rodrigo Peres >> >> >> >> >> on 11/1/01 9:17 PM, Yasuo Ohgaki at [EMAIL PROTECTED] wrote: >> >>> Rodrigo Peres wrote: >>> >>>> Hi list, >>>> >>>> I'm in a big trouble. I'm brazilian, so I've made a script to clean up > the >>>> special caracters from our language in order to not mess up my > publisher, >>>> but this script don't work in Macintosh (macos 9.1, IE 5, all in > american >>>> english). >>>> >>>> This is my code >>>> >>>> >>>> >>> function myclean(&$name) { >>>> $name = strtolower(strtr($name, >>>> "áéíóúàèìòùäëïöüâêîôûãçÁÉÍÓÚÀÈÌÒÙÄËÏÖÜÂÊÎÔÛÃÇ ", >>>> "aeiouaeiouaeiouaeiouacAEIOUAEIOUAEIOUAEIOUAC")); >>>> return $name; >>>> } >>>> $temp = myclean($name_actor); >>>> echo($temp); >>>> ?> >>>> >>>> What happens is if i try for example to clean up "São Paulo" it prints > "são >>>> paulo". Why?? >>>> The "$name" will receive a string form a text field in a form. my html >>>> charset is iso-8859-1 >>> >>> >>> I think you are better to use recode extension for this. >>> Check out recode manual page. >>> >>> -- >>> Yasuo Ohgaki >>> >> >> -- >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> To contact the list administrators, e-mail: [EMAIL PROTECTED] >> >> >> > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Problem with non us caracters and "strtr"
I have little experience with this kind of problem. None of the Browsers I used under mac (IE 4 - 5 and sever NS 4.x) has sent the data different than Windows Browsers. But avoid the meta-tag charset. I had serious problems when the HTML-file where the form data came from had that tag set (but I didn't spend a lot of time investigating it). Anyway: why do you want to translate a ã to an a? I made good experiences with storing original chars and using htmlentities() (or otherway round if you don't have to edit that stuff) Stefan Rusterholz, [EMAIL PROTECTED] -- interaktion gmbh Stefan Rusterholz Zürichbergstrasse 17 8032 Zürich -- T. +41 1 253 19 55 F. +41 1 253 19 56 W3 www.interaktion.ch -- - Original Message - From: "Rodrigo Peres" <[EMAIL PROTECTED]> To: "Yasuo Ohgaki" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, November 02, 2001 2:51 PM Subject: Re: [PHP] Re: Problem with non us caracters and "strtr" > I've tried the recode(), but I think I didn't uderstand it's functionality, > since nothing happens. can someone has an idea in how to convert for example > a string posted by a form in this format "são paulo" to this "sao paulo"?? > Does anyone knows how Macintosh's browsers send this special caracteres to > PHP??? > > Thank's again > > Rodrigo Peres > > > > > on 11/1/01 9:17 PM, Yasuo Ohgaki at [EMAIL PROTECTED] wrote: > > > Rodrigo Peres wrote: > > > >> Hi list, > >> > >> I'm in a big trouble. I'm brazilian, so I've made a script to clean up the > >> special caracters from our language in order to not mess up my publisher, > >> but this script don't work in Macintosh (macos 9.1, IE 5, all in american > >> english). > >> > >> This is my code > >> > >> > >> >> function myclean(&$name) { > >> $name = strtolower(strtr($name, > >> "áéíóúàèìòùäëïöüâêîôûãçÁÉÍÓÚÀÈÌÒÙÄËÏÖÜÂÊÎÔÛÃÇ ", > >> "aeiouaeiouaeiouaeiouacAEIOUAEIOUAEIOUAEIOUAC")); > >> return $name; > >> } > >> $temp = myclean($name_actor); > >> echo($temp); > >> ?> > >> > >> What happens is if i try for example to clean up "São Paulo" it prints "são > >> paulo". Why?? > >> The "$name" will receive a string form a text field in a form. my html > >> charset is iso-8859-1 > > > > > > I think you are better to use recode extension for this. > > Check out recode manual page. > > > > -- > > Yasuo Ohgaki > > > > -- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Problem with non us caracters and "strtr"
I've tried the recode(), but I think I didn't uderstand it's functionality, since nothing happens. can someone has an idea in how to convert for example a string posted by a form in this format "são paulo" to this "sao paulo"?? Does anyone knows how Macintosh's browsers send this special caracteres to PHP??? Thank's again Rodrigo Peres on 11/1/01 9:17 PM, Yasuo Ohgaki at [EMAIL PROTECTED] wrote: > Rodrigo Peres wrote: > >> Hi list, >> >> I'm in a big trouble. I'm brazilian, so I've made a script to clean up the >> special caracters from our language in order to not mess up my publisher, >> but this script don't work in Macintosh (macos 9.1, IE 5, all in american >> english). >> >> This is my code >> >> >> > function myclean(&$name) { >> $name = strtolower(strtr($name, >> "áéíóúàèìòùäëïöüâêîôûãçÁÉÍÓÚÀÈÌÒÙÄËÏÖÜÂÊÎÔÛÃÇ ", >> "aeiouaeiouaeiouaeiouacAEIOUAEIOUAEIOUAEIOUAC")); >> return $name; >> } >> $temp = myclean($name_actor); >> echo($temp); >> ?> >> >> What happens is if i try for example to clean up "São Paulo" it prints "são >> paulo". Why?? >> The "$name" will receive a string form a text field in a form. my html >> charset is iso-8859-1 > > > I think you are better to use recode extension for this. > Check out recode manual page. > > -- > Yasuo Ohgaki > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]