Skip to main content

Command Palette

Search for a command to run...

Correctness - Method encodes String bytes without specifying the character encoding

Published
1 min read
S

I love learning about technology and sharing that with others

Code smell is thrown when

 byte[] byteResponse = clientResponse.getPayload();
String jsonString=new String(byteResponse);
  • Solution
  • mention the encoding while creating the string from the byte response
 String jsonString=new String(byteResponse,StandardCharsets.UTF_8);
105 views

More from this blog

H

hashcodehub

271 posts

Consistent, Passionate and Organized :)