开发者

Is there something magical about this? The file always turns to ANSI

开发者 https://www.devze.com 2022-12-15 09:19 出处:网络
I have created a file and saved it as UTF-8 I placed this code: <div class=\"top_pic\"> <img src=\"<?php echo $this->images_dir ?>image.jpg\" alt=\"doc ao fim do dia\" width=\"632\"

I have created a file and saved it as UTF-8 I placed this code:

<div class="top_pic">
    <img src="<?php echo $this->images_dir ?>image.jpg" alt="doc ao fim do dia" width="632" height="320"/>
</div>
<div id="conteudo_menu">
    <?php echo $this->conteudo_menu ?>
</div>
<div id="item_list">
    <?php echo $this->vinhos_lista ?>
</div>

I save and reopen and it's iso-8859-1.

I have tried modifying it using notepad++ and dreamweaver.

Always the same result. This is messing up the page, because the page presents strings in utf-8.

Please开发者_如何学Go!! Someone help me!!

EDIT:

I finally fixed this. I used mb_convert_encoding to force everything to be utf8.

Thanks for all the help!


PHP doesn't look at or even know what encoding your script file is - PHP simply considers it as a bunch of single-byte characters, and something happens based on these characters. Nothing prevents you from using the characters in such a way that the bytes correspond to UTF-8 (which you should, by the way), but it's your responsibility to send the appropriate Content-Type header (header('Content-Type: text/html;charset=utf-8'); before any output is sent) and/or META-tag to make sure the page is interpreted correctly, and to ensure any database connections use the proper character set.

0

精彩评论

暂无评论...
验证码 换一张
取 消