Spanish Characters not Displaying Correctly

后端 未结 7 1983
心在旅途
心在旅途 2021-02-08 12:24

I am getting the lovely � box where spanish characters should be displayed. (ie: ñ, á, etc). I have already made sure that my meta http-equiv is set to utf-8:

&         


        
7条回答
  •  走了就别回头了
    2021-02-08 13:14

    I have suffered this problem for many years and I can't find any logic and I have tried all the solutions above.

    One solution is to make html codes for all text. Here is a function I have used when all else has failed.

    function span_accent($wordz)
    {
    
    $wordz = str_replace( "Á","Á",$wordz);
    $wordz = str_replace( "É","É",$wordz);
    $wordz = str_replace( "Í","Í",$wordz);
    $wordz = str_replace( "Ó","Ó",$wordz);
    $wordz = str_replace( "Ú","Ú",$wordz);
    $wordz = str_replace( "Ñ","Ñ",$wordz);
    $wordz = str_replace( "Ü","Ü",$wordz);
    
    $wordz = str_replace( "á","á",$wordz);
    $wordz = str_replace( "é","é",$wordz);
    $wordz = str_replace( "í","í",$wordz);
    $wordz = str_replace( "ó","ó",$wordz);
    $wordz = str_replace( "ú","ú",$wordz);
    $wordz = str_replace( "ñ","ñ",$wordz);
    $wordz = str_replace( "ü","ü",$wordz);
    
    $wordz = str_replace( "¿","¿",$wordz);
    $wordz = str_replace( "¡","¡",$wordz);
    $wordz = str_replace( "€","€",$wordz);
    $wordz = str_replace( "«","«",$wordz);
    $wordz = str_replace( "»","»",$wordz);
    $wordz = str_replace( "‹","‹",$wordz);
    $wordz = str_replace( "›","›",$wordz);
    return $wordz;
    }
    

提交回复
热议问题