Java Unicode字符到UTF

Java Unicode字符到UTF,java,string,unicode,utf-8,Java,String,Unicode,Utf 8,在Java中,如何将包含转义为utf 8的unicode字符的字符串转换为utf 8,例如从Rüppell's_Vulture转换为R%c3%Bppell's_Vulture String s = URLDecoder.decode("R%c3%bcppell's_Vulture", "UTF-8"); String s = URLEncoder.encode("Rüppell's_Vulture", "UTF-8"); 它是一种URL编码。使用getBytes(“UTF-8”)将其复制到字节

在Java中,如何将包含转义为utf 8的unicode字符的字符串转换为utf 8,例如从Rüppell's_Vulture转换为R%c3%Bppell's_Vulture

String s = URLDecoder.decode("R%c3%bcppell's_Vulture", "UTF-8");
String s = URLEncoder.encode("Rüppell's_Vulture", "UTF-8");

它是一种URL编码。

使用getBytes(“UTF-8”)将其复制到字节数组。如下所示:

byte[] utf = String.getBytes("UTF-8")

不知道如何处理字符串(我相信它们有固定的编码).

%c3%不是UTF-8,而是html-escape@Uwe:
%c3
不是,但是。@BalusC谢谢你提供的信息User1774937:你的问题很奇怪。你显然混淆了一些基本概念。你最终想对转义/编码字符串做什么?例如,你认为它的功能要求是什么s可能是正确的解决方案?只有这样,才能给出正确的答案。它做的是相反的,即R%c3%B对Rüppell