记事本++显示ucs-2LE,而ubuntu FILE [file]显示UTF-16LE,我感到困惑吗? [英] notepad ++ shows ucs-2LE while ubuntu FILE [file] shows UTF-16LE, I am confused?

查看:184
本文介绍了记事本++显示ucs-2LE,而ubuntu FILE [file]显示UTF-16LE,我感到困惑吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将从mssql生成的文件转换为utf-8.当我在Windows Server 2003中使用记事本++打开他mssql的输出时,将文件识别为UCS-2LE,我使用file [file]将文件复制到Ubuntu计算机,它显示编码为UTF-16LE. 确实很困惑,因为名称不同,所以编码必须有所区别. 但是为什么我会在同一文件中看到它.它是从mssql查询生成的.csv文件.

I am trying to convert the file generated from a mssql to utf-8. When I open the output of he mssql using notepad++ in windows server 2003 recognises the file as UCS-2LE I copied the file to a Ubuntu machine, using file [file] it shows that the encoding is UTF-16LE. Really confused, there must be some difference in encoding, as the names are different. But why do I see this in the same file. Its a .csv file generated from the mssql query.

推荐答案

在大多数情况下,UTF-16和UCS-2是同一件事.没有区别.

For the most part, UTF-16 and UCS-2 are the same thing. There is no difference.

这意味着每个字符都是两个字节宽. "LE"代表 little endian ,即每个两个字节的字符都以低字节开头存储.

What it means is that each character is two bytes wide. "LE" stands for little endian, i.e. each two-byte character is stored with the low byte first.

如果要转换为UTF-8,请在Notepad ++中单击编码"菜单中的Convert to UTF-8,然后保存.

If you want to convert to UTF-8, in Notepad++ click Convert to UTF-8 in the Encoding menu, then save.

如果其他程序在执行此操作后使文件阻塞,或者在文件的开头看到两个垃圾字符,请单击Convert to UTF-8 without BOM.

If your other programs choke on the file after doing this, or you see two garbage characters at the start of the file, then click Convert to UTF-8 without BOM instead.

这篇关于记事本++显示ucs-2LE,而ubuntu FILE [file]显示UTF-16LE,我感到困惑吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆