简体   繁体   中英

Change UTF-8 Formatting to LATIN 2 via PHP

I have a simple problem. I am using iconv to convert UTF-8 to LATIN 2 liek this

$res = file_put_contents($edi_path, iconv('utf-8', 'CP852', $html));

but the output file is win 1250 or by php detected as ISO and special characters are not interpreted correctly, so i tried to open it in PSPAD save as Latin 2, close it, and open again it works fine and everything looks good.

So problem is in my PHP code, any advice?

Try

iconv("UTF-8","Windows-1250", $html);

Default encoding of browser depends on your regional settings in system. You must consider what setting have your PC and server. In IE for example you can choose coding from right click of mouse. Windows migrated from CP852(DOS) to CP-1250 (Windows CE).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM