Re: Reading files in tcl that are unicode encoded

From: Kiran Madabhushi (maskiran_at_yahoo.com)
Date: 05/20/04


Date: 20 May 2004 04:44:13 -0700

Michael Schlenker <schlenk@uni-oldenburg.de> wrote in message news:<2gugmlF6uvb2U1@uni-berlin.de>...
> Kiran Madabhushi wrote:
> > Hi,
> > I saved a txt file from notepad in UTF-8 format (or unicode format, as
> > these are the 2 options I have in windows notepad). I started a Wish
> > shell in windows and when I do a glob *.txt, the file name is show in
> > unicode encoded characters (even the file name is saved as unicode
> > format). I want to display this file in wish text box so that it
> > appears same as that in Notepad. Can I do that in Wish. If not what
> > else has to be done to show this file n text box. I assume that if
> > this can be shown in text box, the same holds for entry.
> >
>
> This should work, could stumble over the byte order markers Notepad
> places in error
> (http://sourceforge.net/tracker/index.php?func=detail&aid=800114&group_id=10894&atid=110894
> )
>
> package require Tk
> set file [tk_getOpenFile]
> set fd [open $file]
> fconfigure $fd -encoding utf-8
> set text [read $fd]
> close $fd
> text .t -width 80
> pack .t
> .t insert end $text
>
> Michael

Thanks Michael, this helped me. Now I have q more question. How do I
type characters so that they are shown in unicode glyph. e.g. I set
the input language on my WinXP to be something other than English.
When I do something in Notepad, it shows in the respective font. But
if i do the same thing in TCL Entry / text box, only question marks
are shown. I want the characters in Entry boxes also to be same as
those shown in notepad

Thanks
Kiran



Relevant Pages

  • Re: Compile Problems
    ... You can also open the exe in notepad - near the top of the file is an entry ... know is that it isnt a .NET version as some of the functions, ...
    (microsoft.public.vb.general.discussion)
  • Re: Open file without extension with notepad
    ... See if notepad or any junk entry is listed at startup. ... HKCU/run the application for some reason is not able to start and this ...
    (microsoft.public.windowsxp.customize)
  • Re: C - gets() function implementation help
    ... Or vi, or notepad. ... Or even a shell. ... Or text entry in a browser window. ...
    (comp.lang.c)
  • Re: playing part of a song - like "Mark In"
    ... and it's fairly easy in notepad to edit a playlist file. ... You can add a STARTTIME tag to your media file here: ... an <Entry> tag, add it in there. ... When you open the playlist, the track will now play from the specified ...
    (microsoft.public.windowsmedia.player)
  • Re: HTML Help Files (.chm)
    ... lots of Question Marks etc like this: ... If i right click and View Source in Notepad the text is normal and ... What application do you use to open your .chm files with? ... Lorraine ...
    (microsoft.public.windowsxp.general)