File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/main/java/org/wise/portal/presentation/web/controllers Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 66import java .io .OutputStreamWriter ;
77import java .net .HttpURLConnection ;
88import java .net .URL ;
9-
109import org .springframework .beans .factory .annotation .Autowired ;
1110import org .springframework .core .env .Environment ;
1211import org .springframework .security .access .annotation .Secured ;
@@ -36,13 +35,14 @@ protected String sendChatMessage(@RequestBody String body) {
3635 HttpURLConnection connection = (HttpURLConnection ) url .openConnection ();
3736 connection .setRequestMethod ("POST" );
3837 connection .setRequestProperty ("Authorization" , "Bearer " + openaiApiKey );
39- connection .setRequestProperty ("Content-Type" , "application/json" );
38+ connection .setRequestProperty ("Content-Type" , "application/json; charset=utf-8" );
39+ connection .setRequestProperty ("Accept-Charset" , "UTF-8" );
4040 connection .setDoOutput (true );
4141 OutputStreamWriter writer = new OutputStreamWriter (connection .getOutputStream ());
4242 writer .write (body );
4343 writer .flush ();
4444 writer .close ();
45- BufferedReader br = new BufferedReader (new InputStreamReader (connection .getInputStream ()));
45+ BufferedReader br = new BufferedReader (new InputStreamReader (connection .getInputStream (), "ISO-8859-1" ));
4646 String line ;
4747 StringBuffer response = new StringBuffer ();
4848 while ((line = br .readLine ()) != null ) {
You can’t perform that action at this time.
0 commit comments