Tcl Library Source Code

View Ticket
Login
2024-01-09
09:50 • Ticket [1f29f7baf9] ncgi::encode broken with Tcl 9 / ncgi::encode encodes to iso8859-1 status still Open with 3 other changes artifact: 9e26a85bf4 user: aku
2023-10-06
16:07 • Ticket [1f29f7baf9]: 4 changes artifact: d256d8715a user: pointsman
2023-07-07
15:04 • New ticket [1f29f7baf9]. artifact: aa2c8442d5 user: pointsman

Ticket UUID: 1f29f7baf9de2d615f7d15cb119065d3c0174bf1
Title: ncgi::encode broken with Tcl 9 / ncgi::encode encodes to iso8859-1
Type: Bug Version: 1.4.4
Submitter: pointsman Created on: 2023-07-07 15:04:22
Subsystem: ncgi Assigned To: aku
Priority: 5 Medium Severity: Severe
Status: Open Last Modified: 2024-01-09 09:50:51
Resolution: None Closed By: nobody
    Closed on:
Description:
Due to TIP 465 ncgi::encode is broken with Tcl 9. I've added a test for this (with knownBug constraint) to tcl9-testarea-rde. The core of the test is just:

package reqiure Tcl 9.0
package require ncgi
ncgi::encode "("]

=> error invalid character in array index

That needs fixing.

Though, ncgi::encode encodes in iso8859-1 encoding. See:

ncgi::encode ö => %F6

If encoding in UTF-8 this would be %C3%B6.

In the days ncgi was published this was surely the right thing to do (encoding in iso8859-1, I mean). Nowadays most would expect the encoding to be in UTF-8. So perhaps this functionality should change. As bare minimum it should be noted in the documentation, so that the programmer knows that this perhaps is not what he wants.
User Comments: pointsman added on 2023-10-06 16:07:43:
I changed the ncgi::encode implementation on tcl9-testarea-rde branch so that
it works with Tcl with and without TIP 465.

The proc still encodes in iso8859-1 encoding, which surely was the expected
(and right) thing to do at times the code was written.

Nowadays most people expect utf-8 encoding. So as bare minimum this should
be noted in the documentation. Ideally a new pair of procs
utf8encode/utf8decode is added.