Skip to content

Commit

Permalink
after thorough investigation, the commits e187501 and 5e0ab71 have been
Browse files Browse the repository at this point in the history
largely reverted while keeping the tclrega+tclrpc sources at the current
state of affairs so that a proper charset encoding conversion is
performed within tclrega+tclrpc while tcl is now defaulting to the
iso8859-1 encoding again. While this is largely a revert to the state of
affairs of the 3.63.8.20220330 release this closes #1825 and refs #1821
and brings us back to the state of #1782 where certain external addons
like hm_pdetect have to be partly reworked to get character encoding
fixed. However, the WebUI itself should now correctly work with these
reverts.
  • Loading branch information
jens-maus committed May 10, 2022
1 parent cf0a81f commit e2e472f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
--- occu/WebUI/www/api/eq3/jsonrpc.tcl.orig
+++ occu/WebUI/www/api/eq3/jsonrpc.tcl
@@ -41,10 +41,6 @@
@@ -21,7 +21,7 @@
global JSONRPC JSONRPC_ERROR

# set request [string range $request 1 end]
- if { [catch { array set parsedRequest [encoding convertfrom identity [json_parse $request]]} errMsg] } then {
+ if { [catch { array set parsedRequest [encoding convertfrom utf-8 [json_parse $request]]} errMsg] } then {
jsonrpc_error 100 "invalid request ($errMsg)"
}
if { [catch { set JSONRPC(ID) $parsedRequest(id)} ] } then {
@@ -41,9 +41,9 @@
proc jsonrpc_error {errorCode errorText} {
global JSONRPC

- set errorCode [encoding convertto identity $errorCode]
- set errorText [encoding convertto identity $errorText]
- set JSONRPC(ID) [encoding convertto identity $JSONRPC(ID)]
-
+ set errorCode [encoding convertto utf-8 $errorCode]
+ set errorText [encoding convertto utf-8 $errorText]
+ set JSONRPC(ID) [encoding convertto utf-8 $JSONRPC(ID)]

puts "CONTENT-TYPE: application/json; charset=utf-8"
puts ""
puts "\{"
@@ -72,9 +68,6 @@
@@ -72,8 +72,8 @@
proc jsonrpc_response {result} {
global JSONRPC

- set result [encoding convertto identity $result]
- set JSONRPC(ID) [encoding convertto identity $JSONRPC(ID)]
-
+ set result [encoding convertto utf-8 $result]
+ set JSONRPC(ID) [encoding convertto utf-8 $JSONRPC(ID)]

puts "CONTENT-TYPE: application/json; charset=utf-8"
puts ""

@@ -84,7 +77,11 @@
@@ -84,7 +84,11 @@
puts -nonewline "\"id\": $JSONRPC(ID),"
}
puts -nonewline "\"version\": \"1.1\","
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ proc jsonrpc_parse {request} {
global JSONRPC JSONRPC_ERROR

# set request [string range $request 1 end]
if { [catch { array set parsedRequest [encoding convertfrom identity [json_parse $request]]} errMsg] } then {
if { [catch { array set parsedRequest [encoding convertfrom utf-8 [json_parse $request]]} errMsg] } then {
jsonrpc_error 100 "invalid request ($errMsg)"
}
if { [catch { set JSONRPC(ID) $parsedRequest(id)} ] } then {
Expand All @@ -41,6 +41,10 @@ proc jsonrpc_parse {request} {
proc jsonrpc_error {errorCode errorText} {
global JSONRPC

set errorCode [encoding convertto utf-8 $errorCode]
set errorText [encoding convertto utf-8 $errorText]
set JSONRPC(ID) [encoding convertto utf-8 $JSONRPC(ID)]

puts "CONTENT-TYPE: application/json; charset=utf-8"
puts ""
puts "\{"
Expand Down Expand Up @@ -68,6 +72,9 @@ proc jsonrpc_error {errorCode errorText} {
proc jsonrpc_response {result} {
global JSONRPC

set result [encoding convertto utf-8 $result]
set JSONRPC(ID) [encoding convertto utf-8 $JSONRPC(ID)]

puts "CONTENT-TYPE: application/json; charset=utf-8"
puts ""

Expand Down

This file was deleted.

0 comments on commit e2e472f

Please sign in to comment.