You are here: Re: [PHP] Problem with special chars. « PHP « IT news, forums, messages
Re: [PHP] Problem with special chars.

Posted by Jochem Maas on 10/14/05 14:16

Erfan Shirazi wrote:
> The problem is if I don't specify and encoding even an echo() on the

specify a different encoding if you don't want html entities.

> string shows strange chars when I have made a mb_strtoupper() on the
> string. With HTML-ENTITIES at least it looked ok when you made an echo()

of course it looks ok - the browser is showing you the characters that the
html entities represent.

this string: 'Ó'
....is an html entity.

> but when saved in file it looks bad.

time for you to find out (STFW) about html entities and encoding in general

>
> Does anybody now what I can do in order to make the string into capital

try setting your encoding to 'UTF-8' or some such, your mileage may vary.

> letters, be able to save it to a file and looking as it should look,
> that is: Asunción and not ASUNCIÓN?
>
> /Erfan
>
>
> Jochem Maas wrote:
>
>> Erfan Shirazi wrote:
>
>
>
>>
>>> Hi all
>>>
>>>
>>> I have some problems when I make a string containing the following
>>> "Malmö, Asunción" to capital letters and then save it to a file.
>>>
>>> I use the following to make it to capital letters:
>>> $msg = mb_strtoupper($msg, "HTML-ENTITIES");
>>
>>
>> ^- you are telling mb_strtoupper to
>> encode your 'funky' chars into html entities.
>>
>>>
>>> And this works just fine, everything looks as it should, but when I
>>> save it to a file, this is how it looks:
>>> "MALMÖ, ASUNCIÓN
>>
>>
>> ^\ \---------------------- notice the names: 'Ouml'
>> meaning. 'O umlaut'
>>
>>>
>>> It seems it has problems with "ó" and "Ö", does anybody know how this
>>
>>
>>
>> it has no problems AFAICT, the characters you mention have been turned
>> into html entities... these entities (in the form '&' + xyz + ';') are
>> shown in the browser as the relevant char.
>>
>>> can be solved? I have tried some different encodings but nothing helps,
>>
>>
>>
>> the solution is to not convert to html entities, or (if its required)
>> only
>> converting to html entities when you want to output something to the
>> browser
>>
>>> I'm using PHP 4.3.2.
>>>
>>> Thx in advance for all help.
>>>
>>> /Erfan
>>>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация