XAMPP: setting the encoding type globally

谁说胖子不能爱 提交于 2019-12-12 01:46:55

问题


When I run a csv parser on my windows machine, and redirect the output into a file, I always get doubled up line breaks when I open the file in OpenOffice Calc. Further, if I copy the contents of the file in notepad++, then save that as a new file using the default ANSI encoding, the file is half as big and line breaks display properly in Calc.

I'd prefer not to have to add a setting or header to every file I work on, since these scripts work fine on a linux install of PHP.

I assume that changing a setting in php.ini will fix this, but I don't know what it is and I haven't had much luck finding it. Does anyone know how to resolve this issue?


回答1:


There is an INI directive to change the character set sent by default in the Content-Type header:

Per example:

default_charset = "iso-8859-1"



回答2:


Huh? You want to create a text file that opens correctly in both windows and linux?

Tough luck. Both operating system uses different ways to denote new lines. One uses a new line, where else the other ses a new line and a carrage return.

In Linux, there are programs called "dos2unix" and "unix2dos" that converts text for you between the windows and linux world. I think you will need to use that everytime you copy the files between the operating systems.



来源:https://stackoverflow.com/questions/7934041/xampp-setting-the-encoding-type-globally

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!