Thank you for clarifications Gustaf, i'll check what's going on with my code.
On Sun, Jul 11, 2021 at 5:00 PM Gustaf Neumann <neum...@wu.ac.at> wrote: > > On 11.07.21 14:14, Maksym Zinchenko wrote: > > Hello,I'm having trouble with encodings, or maybe I don't understand > something. > My first question is: when I run *"ns_charsets*" command it will not > return UTF-8 encoding in the list, why and what does it mean? > > Dear Maksym, > > "ns_charsets" is a code that was not touched since a very long time. In > essence, it provides a mapping between "official" charset names and > tcl-encodings. In general charsets can have multiple names for the the same > thing (preferred MIME name, official name, aliases) > > For example the preferred mime charset "iso-8859-1" is mapped to the > Tcl_Encoding named "iso8859-1". If a charset name is not returned via > "ns_charsets", it is used literally. So, the charset "utf-8" is mapped the > the Tcl_encoding with the same name. The charset mapping can be extended > via the configuration file (section "ns/charsets").... so in essence, > "ns_charset" just returns entries which require special mappings. > > When i look at the IANA page, i see several entries there, which are not > in the naviserver default table. So, one should check, what's feasible to > be added. > > The Second problem is: I'm trying to *"ns_return"* XML UTF-8 data from my > RESTFull API responder. > ns_return 200 "application/xml; charset=utf-8" [dict get $response data] > > But firefox complains about "XML Parsing Error: not well-formed" it will > get stuck at portuguese characters, Response header in firefox dev console > shows: "Content-Type > application/xml; charset=utf-8", what I'm doing wrong? > > Probably, the "data" element of dict "response" contains binary data (a > Tcl byte array). > I can see nothing wrong in NaviServer, check below for a minimal test > setup. > > all the best > > -gn > > ============================================================================================== > xml-responder.tcl > ns_return 200 "application/xml; charset=utf-8" > <root><name>Motörhead</name></root>\n > ============================================================================================== > > Testing: > > $ curl -k -i https://localhost:8443/xml-responder.tcl > HTTP/1.1 200 OK > Server: NaviServer/4.99.21 > Date: Sun, 11 Jul 2021 17:51:50 GMT > Content-Type: application/xml; charset=utf-8 > Content-Length: 37 > Connection: keep-alive > X-Content-Type-Options: nosniff > X-XSS-Protection: 1; mode=block > Referrer-Policy: strict-origin > > <root><name>Motörhead</name></root> > > > _______________________________________________ > naviserver-devel mailing list > naviserver-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/naviserver-devel >
_______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel