Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6f50a3e4616ccca7d379b642dfd137136219bf40a7f3d9a150b19a8130e10985
Ticket: 9bad909c6ed4691bcad1886d710a923791a524a2
jis0208 encoding fails for ASCII input
User & Date: apnadkarni on 2021-06-12 10:18:01
Changes

  1. icomment:
    From the Tclers' chat:
    
    aspect:
    Even with preference for doubl width encoding convertto and convertfrom should match" ... well, necessarily not always
    
    if (what seems to be the current interpretation) only fullwidth Latin characters exist in the target set, then "a" can't round-trip
    2:38
    if the encoding interprets what's in that table to mean that both u+0061 and u+ff41 map to the same encoding, then only one of those can round-trip
    
    apn:
    @aspect, I wasn't even aware there was a full width a (thereby showing my ignorance in this area). So are you saying it is not a bug because no round tripping is possible?
    
    aspect:
    well it might be a bug - bit even if it is, some round trips will not be possible.  I don't know whether it's better for jis0209 to map ascii latin characters vs fullwidth versions, or if the version of [encoding convertto] that takes both to the same codepoints is a good idea
    
    pooryorick:
    apn, the bug is that [encoding convertfrom] converts one character to another character.
    
    pooryorick:
    aspect, why should [enocding convertfrom] convert a narrow "a" to a wide "a"?
    
    aspect:
    It doesn't
    [encoding convertfrom jis0208 [encoding convertto jis0208 a\uff41]] produces "\uff1f\uff41".  That matches the intermediate encoded bytes.  The change is when convertto doesn't know how to encode "a" so it subtitutes a fullwidth question mark
    
    So I do not know if this is a real bug or not. It was certainly surprising behavior to me. I'll leave open for someone knowledgeable to mark appropriately.
    
  2. login: "apnadkarni"
  3. mimetype: "text/plain"