From: Hidetoshi NAGAI Date: 2004-02-24T01:01:38+09:00 Subject: Re: TkPhotoImage :data=>buf Hi, From: "Ara.T.Howard" Subject: TkPhotoImage :data=>buf Date: Sun, 22 Feb 2004 02:44:51 +0900 Message-ID: > does anyone know if this is simply a limitation of the gif formatted images? It's a bug. I understand the reason og the trouble. But it may be a little difficalt to fix. The bug depends on string interchange between Ruby and Tk interpreter. To avoid the trouble of the difference of encoding between the interpreters, current Ruby/Tk converts encoding of strings automatically. Usually it will be convenient for Ruby/Tk users. Therefore, when treats a binary string (especially, includes null bytes), the data is garbled. To fix the bug, I'll have to edit tcltklib.c and TkVariable class, and add a new class "Tk::BinaryString" which is a subclass of Tk::EncodedString class. A Tk::EncodedString instance is a string with encoding information. By creating a Tk::BinaryString instance (has a special encoding 'binary') for a binary string, Ruby/Tk recognizes that the string never be converted and never be terminated by a null byte. Although this strategy may trouble Ruby/Tk users, it will be an actual and reasonable solution. I think so. Probably I'll have to change the implementation of TkVariable class. My only worry is en-bugging by side effects. Please wait for a good news about this. It will not be far-off. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)