Note that there are some explanatory texts on larger screens.

plurals
  1. POUTF8 encoding difficulty using PHP in Notepad++
    text
    copied!<p>I have been making a program that creates multiple CSV's from another source CSV (encoded in 'SJIS'/SHIFT-JIS). Here's the process in which I am creating them:</p> <ol> <li>Create a string, which will hold the contents of the output CSV's</li> <li>Fill in said strings with their proper information</li> <li>Encode the string to UTF-8 from SJIS using mb_convert_encoding() code:<br> $contents2 = mb_convert_encoding($contents, "UTF-8", "SJIS");</li> <li><p>Create a zip archive using PHP's provided library methods and append the files I desire with their corresponding strings using addFromString() code:<br> $zipFileName = "output.zip";</p> <pre><code> $zip = new ZipArchive; if ($zip-&gt;open($zipFileName, ZipArchive::CREATE) === TRUE){ $zip-&gt;addFromString('customer.csv', $contents2); ...do for the other files $zip-&gt;close(); } else{ echo 'Failed! File not created!'; } </code></pre></li> <li>Prompt the user with a dialogue box to save the file in their desired location. code: $zipContents = file_get_contents($zipFileName); header('Content-Type: application/zip'); header("Content-Disposition: attachment; filename=inflow.zip"); header("Pragma: no-cache"); header("Expires: 0"); echo $zipContents;</li> </ol> <p>Now here is my problem: The files that I have created from the zip file are encoded in "UTF-8 without BOM" when I open it in Notepad++. However, I require for these files to just be in plain "UTF-8". A inventory program I am using to upload these files, for reasons beyond me, will not show the proper characters for the CSV's encoded in "UTF-8 without BOM". Once I manually: open the files, re-encode it as "UTF-8", and save them, are the files able to display the correct characters in this inventory program. </p> <p>I have read a good deal of articles talking about the converse of this problem, where people were seeking to make their UTF-8 files become encoded without BOM. However, my situation is the exact opposite of this. If there's an easy solution in PHP I would more than welcome the help! Thanks for reading!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload