在1252编码到Unicode .NET等效于java [英] Encoding from 1252 to Unicode .NET equivalent in java

查看:124
本文介绍了在1252编码到Unicode .NET等效于java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有将.NET Web服务移植到java的请求。我需要找到这段代码写在.NET中的等效的java代码:

I have the request to port a .NET web service to java. I need to find the equivalent java code for this piece of code written in .NET:

byte[] b = ... // Some file binary data.
byte[] encoded = System.Text.Encoding.Convert(System.Text.Encoding.GetEncoding(1252), System.Text.Encoding.Unicode, b);

提前感谢

推荐答案

byte[] b = ...
byte[] encoded = new String(b, "Cp1252").getBytes("UTF-16");

这篇关于在1252编码到Unicode .NET等效于java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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