Portuguese charset problem

前端 未结 6 1171
别跟我提以往
别跟我提以往 2020-12-10 21:06

I’m a headache with the damn charset.

Portuguese charset=iso-8859-1

On my HTML I have:



        
6条回答
  •  南方客
    南方客 (楼主)
    2020-12-10 22:01

    I would look at the default charset in the browser first, it could be set to ISO-8859-15 or UTF8. I have had the reverse problem of my browser encoding was set to ISO-8859-1 instead of UTF8.

    Secondly is this data static or coming from a database? If it is from mySQL for example, check the collation of the database, is it in latin1 or utf8? If coming from a UTF8 collated database (or not - as you're using PHP) you can try

    $string = 'café';
    utf8_decode($string);
    

    OR

    $string = 'café';
    utf8_encode($string);
    

    Moving to UTF8 may be a good idea because functions like PHPs utf8_encode() and utf8_decode() but if it's not appropriate to your market then that is that.

    If the utf8_encode or utf8_decode functions work, you should look at your input method and input encoding as you will likely find a problem there.

    P.S. I have the same problems from time to time being in Brazil... I feel your pain mate!

提交回复
热议问题