使用iconv从UTF-16LE转换为UTF-8 [英] Using iconv to convert from UTF-16LE to UTF-8

查看:1016
本文介绍了使用iconv从UTF-16LE转换为UTF-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Microsoft SQL服务器转换一些日志文件,但是这些文件是使用UTf-16LE编码的,iconv似乎无法转换它们.

Hi I am trying to convert some log files from a Microsoft SQL server, but the files are encoded using UTf-16LE and iconv does not seem to be able to convert them.

我正在做:

iconv -f UTF-16LE -t UTF-8 <filename>

我还尝试删除该行末尾的所有回车符(如果有的话),但这也无法解决.如果我使用可以正常工作的gedit保存它,但这不是可行的解决方案,因为我有数百个这些文件.

I also tried to delete any carriage returns from the end of the line if there are any, but that did not fix it either. If I save it using gedit that works, but this is not a viable solution since I have hundreds of those files.

编辑:请为缺少的选项查看新答案

EDIT: Please see the new answer for the missing option

推荐答案

我忘记了-o开关!

最后一个命令是:

iconv -f UTF-16LE -t UTF-8 <filename> -o <new-filename>

这篇关于使用iconv从UTF-16LE转换为UTF-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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