如何在hive中将ansi转换为utf8
我想在配置单元中使用自定义输入格式,我在这里找到代码: https://github.com/msukmanowsky/OmnitureDataFileInputFormat 但是当我完成测试代码时,我发现我要在hive中解析的ftp日志文件是由“ANSI”(实际上是“GBK”)编码的,因此结果无法在java控制台中正常显示。
请问您能帮我看看如何转换代码才能正常显示吗,谢谢。 您可以在 OmnitureDataFileInputFormat 中制作一个示例。代码在地址中: https://github.com/msukmanowsky/OmnitureDataFileInputFormat。
多谢!
I want to use custom inputformat in hive, i find the code here:
https://github.com/msukmanowsky/OmnitureDataFileInputFormat
but when i finished the test code i find that the ftp log files which i want to parse in hive is encoding by "ANSI"("GBK" actually), so the result can't be displayed normally in java console.
So could you help me how to convert the code to make sure the display normally, thanks.
You can make an example in OmnitureDataFileInputFormat. The code is in the address:
https://github.com/msukmanowsky/OmnitureDataFileInputFormat.
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下通用 UDF 可用于将 GBK 字符集的字段转换为 UTF-8。
在对该字段进行任何操作之前,应使用此 UDF。
The following Generic UDF can be used to convert a field with GBK charset to UTF-8.
This UDF should be used before you have any operation on this field.