Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Rich Newsgroups: comp.lang.tcl Subject: Re: tdom encoding Date: Tue, 17 Dec 2024 04:20:54 -0000 (UTC) Organization: A noiseless patient Spider Lines: 23 Message-ID: References: Injection-Date: Tue, 17 Dec 2024 05:20:55 +0100 (CET) Injection-Info: dont-email.me; posting-host="876264b18c00e4986a1fe1d9ed3feb32"; logging-data="1639753"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KFQLfGddsaCbImOqOVIur" User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64)) Cancel-Lock: sha1:n91MHD5LQ0kBMnLMDbKUboia7aE= Bytes: 1571 saito wrote: > I am trying to see why tdom is failing on this json snippet. > > package req tdom > set x {{"name":"Jeremi^G"}} > dom parse -json $x > > ==> error "JSON syntax error" at position 15 > "{"name":"Jeremi^G <--Error-- "}" Assuming the ^G that did come through properly represnts the character, then greg is right, it is an ASCII bell character, and per the JSON spec [1] raw control characters are not allowed to be part of a JSON string. Which is why Tdom is telling you 'error' at the ^G output. Are you on linux? If yes the hexdump, objdump, or xxd (xxd is easiest to use) commands will show you exactly what raw byte values exist in the file. [1] https://www.json.org/json-en.html