From 9c476ac7b583a0180ba98701c2a1504eaf7b7b6c Mon Sep 17 00:00:00 2001 From: zabilac630 Date: Wed, 26 Oct 2022 09:34:30 -0700 Subject: [PATCH] Update ASCII Encoding to UTF-8 ASCII example has been related to string encoding bugs, proposing an update to UTF-8 to handle non-ASCII characters --- .../java-basic/src/main/java/example/HandlerStream.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sample-apps/java-basic/src/main/java/example/HandlerStream.java b/sample-apps/java-basic/src/main/java/example/HandlerStream.java index 4b100168..363e4a20 100644 --- a/sample-apps/java-basic/src/main/java/example/HandlerStream.java +++ b/sample-apps/java-basic/src/main/java/example/HandlerStream.java @@ -27,8 +27,8 @@ public class HandlerStream implements RequestStreamHandler { public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException { LambdaLogger logger = context.getLogger(); - BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("US-ASCII"))); - PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream, Charset.forName("US-ASCII")))); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); + PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream, Charset.forName("UTF-8")))); try { HashMap event = gson.fromJson(reader, HashMap.class); @@ -50,4 +50,4 @@ public void handleRequest(InputStream inputStream, OutputStream outputStream, Co writer.close(); } } -} \ No newline at end of file +}