Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 145b33b62ab6978eb6e1c8aa8ed66c24191154b3
Ticket: 839289ffffffffffffffffffffffffffffffffff
http ignores charset in meta tags
User & Date: vincentdarley on 2003-11-11 15:39:30
Changes

  1. icomment:
    Logged In: YES 
    user_id=32170
    
    Jeff, what do you mean by 'the correct options will handle it right'?  I 
    understand now that I was expecting too much from http::geturl, but 
    now it's not clear how to get what I want.
    
    In the above example,
    
    upvar #0 $token state
    puts $state(charset)
    
    gives iso8859-1 (the default) which I suppose I must ignore. However, 
    I also suppose it means the text has been read as iso8859-1 (which 
    could surely cause some irretrievable loss, at least where the true 
    encoding is something more complex than utf-8).
    
    Anyway, I see three approaches:
    
    (i) take the returned text, scan it for <head><meta> etc, extra the 
    charset and convert it (but from what? -- the information in $contents 
    is utf-8 which has been read as iso8859-1!!)
    
    (ii) always use -binary 1 with http::geturl and then manually examine 
    both the headers and (when those headers indicate a text file) convert 
    the text as appropriate
    
    (iii) use a normal http::geturl, but with a callback which looks for <
    head><meta> and charset tags in the case where the info is textual, 
    and in that case adjusts the encoding of the channel on the fly 
    (presumably would need to adjust the encoding of the both the input 
    socket and the output channel).
    
    Any advice on how this should work? 
    
    What most concerns me is the aspect of information loss in (i) if the 
    original text is in an encoding which gets munged if its bytes are 
    interpreted as iso8859-1.
    
    
    
    
  2. login: "vincentdarley"
  3. mimetype: "text/plain"
  4. status changed to: "Open"
  5. username: "vincentdarley"