java 中从 1252 编码为 Unicode .NET 等效项

发布于 2024-12-21 09:57:43 字数 264 浏览 9 评论 0原文

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

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

提前致谢!

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);

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜心小果奶 2024-12-28 09:57:43
byte[] b = ...
byte[] encoded = new String(b, "Cp1252").getBytes("UTF-16");
byte[] b = ...
byte[] encoded = new String(b, "Cp1252").getBytes("UTF-16");
亽野灬性zι浪 2024-12-28 09:57:43

Have a look on the List of Supported Encoding in java. Cp1252 encoding in java is theequivalent encoding of windows 1252.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文