\ 377 \ 376附加到文件(Windows-> Unix) [英] \377\376 Appended to file (Windows -> Unix)

查看:698
本文介绍了\ 377 \ 376附加到文件(Windows-> Unix)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有早晨-

我有问题,解决方案已经暗示了我几天.

I have a problem and the solution has alluded me for a few days now.

我有一个执行以下操作的SSIS程序包. 1.运行SQL脚本 2.将结果导出到平面文件(UTF-8编码,带分隔符和\ n为新行) 3.将FTP结果传输到solaris机器(二进制格式)

I have an SSIS package that performs the following. 1. Run SQL script 2. Export results to flat file (UTF-8 Encoded, ; delimitated, and \n for new lines) 3. FTP results to solaris machine ( binary format )

问题是,当该文件显示在我的solaris框中时,该文件的开头具有以下内容.

The problem is, that when the file is shows up on my solaris box it has the following at the start of the file.

\ 377 \ 376

\377\376

我已尝试过dos2unix,但仍未更正此问题.实际上,它将\ 377 \ 376更改为\ 227 \ 226,不是很有帮助.

I have tried dos2unix and still has not corrected the issue. In fact it changes the \377\376 to \227\226, not very helpful.

我的问题,从文件中删除这些字符的任何方法?当他们在那里时,他们会与grep和其他unix工具(如head)混为一谈.

My question, any way to remove these characters from my file? When they are there they mess with grep and other unix tools like head.

感谢您的帮助.

谢谢

推荐答案

这是一个容易解决的问题,使我迷惑了几天.以为我会回答我自己的问题,以防万一有人在寻找答案.

This was an easy fix that eluded me for a few days. Thought I would answer my own question incase anyone is searching for an answer.

默认情况下,任何SSIS或Windows编码文件都是UCS-2-LITTLE-ENDIAN编码.最简单的方法是使用以下命令在UNIX服务器上对文件进行编码.

By default any SSIS or windows encoded file is UCS-2-LITTLE-ENDIAN encoded. The easiest way is to encode the file on your unix server with the following commands.

  1. 使用iconv切换到UTF-8(或所需的任何编码)

  1. Switch over to UTF-8 (or whatever encoding you need) with iconv

iconv -f UCS-2-LITTLE-EDIAN -t UTF-8输入>输出

iconv -f UCS-2-LITTLE-EDIAN -t UTF-8 input > output

删除ms添加到留置权末尾的回车符.

Remove the carriage returns that ms adds to the end of liens.

unix2dos -ascii utf-8文件输出文件

unix2dos -ascii utf-8-file outputfile

那将解决您的问题.

这篇关于\ 377 \ 376附加到文件(Windows-> Unix)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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