OpenMRS

HttpClient should not rely on default encoding for OutputStreamWriter

Replace this line https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/util/HttpClient.java#L72 with wr = new OutputStreamWriter(connection.getOutputStream(), "UTF-8"); Background Information: Using classes and methods that rely on the default system encoding can result in code that works fine in its "home" environment. But that code may break for customers who use different encodings in ways that are extremely difficult to diagnose and nearly, if not completely, impossible to reproduce when it's time to fix them. Use an alternative API and specify a charset name or Charset object explicitly.

Task tags

  • coding
  • easy

Students who completed this task

Jyothsna Ashok

Task type

  • code Code
close

2017