Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Post Timeline

edited title
Link
Perry
  • 3.9k
  • 26
  • 40
  • 51

How to Encode ascent character into UTF-8 without losing its representation? Any Suggestion

added 16 characters in body
Source Link
Remy Lebeau
  • 610.2k
  • 36
  • 516
  • 875

Method:

public static void test() throws IOException {
 String input = "ABCÉ Ôpqr"; // charsetName = ISO-8859-1
 
 String utf8String = new String(StandardCharsets.UTF_8.encode(input).array());
 }
public static void test() throws IOException {
 String input = "ABCÉ Ôpqr"; // charsetName = ISO-8859-1
 
 String utf8String = new String(StandardCharsets.UTF_8.encode(input).array());
 }

Required Output:

Output : "ABCÉ Ôpqr" Encoding : UTF-8
I wanted to convert String "ABCÉ Ôpqr" into its UTF-8 encoding without loosing its representation.
Output : "ABCÉ Ôpqr" Encoding : UTF-8

I wanted to convert String "ABCÉ Ôpqr" into its UTF-8 encoding without loosing its representation.

Current Output:

Output : "ABC� �pqr"
Output : "ABC� �pqr"

Method:

public static void test() throws IOException {
 String input = "ABCÉ Ôpqr"; // charsetName = ISO-8859-1
 
 String utf8String = new String(StandardCharsets.UTF_8.encode(input).array());
 }

Required Output:

Output : "ABCÉ Ôpqr" Encoding : UTF-8
I wanted to convert String "ABCÉ Ôpqr" into its UTF-8 encoding without loosing its representation.

Current Output:

Output : "ABC� �pqr"

Method:

public static void test() throws IOException {
 String input = "ABCÉ Ôpqr"; // charsetName = ISO-8859-1
 
 String utf8String = new String(StandardCharsets.UTF_8.encode(input).array());
 }

Required Output:

Output : "ABCÉ Ôpqr" Encoding : UTF-8

I wanted to convert String "ABCÉ Ôpqr" into its UTF-8 encoding without loosing its representation.

Current Output:

Output : "ABC� �pqr"
Post Migrated Here from dba.stackexchange.com (revisions)
Source Link

How to Encode ascent character into UTF-8 without losing its representation? Any Suggestion

Method:

public static void test() throws IOException {
 String input = "ABCÉ Ôpqr"; // charsetName = ISO-8859-1
 
 String utf8String = new String(StandardCharsets.UTF_8.encode(input).array());
 }

Required Output:

Output : "ABCÉ Ôpqr" Encoding : UTF-8
I wanted to convert String "ABCÉ Ôpqr" into its UTF-8 encoding without loosing its representation.

Current Output:

Output : "ABC� �pqr"
lang-java

AltStyle によって変換されたページ (->オリジナル) /