Results 1 to 7 of 7
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wordpad and Unicode

    I'm creating a file that may contain Unicode characters.

    The file is called, say, UglyBetty.txt.

    If I double click on the file, Notepad opens the file and the text is properly displayed.
    If I right click and SEnd To Word, I select Unicode encoding and the text is properly displayed.

    If I right click and send to Wordpad, alternate bytes are square boxes.
    Surely there is a way for Wordpad to handle Unicode.
    Did not find anything in WSordpad's Help on this topic.

  2. #2
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    23,571
    Thanks
    5
    Thanked 1,056 Times in 925 Posts

    Re: Wordpad and Unicode

    Try saving it as a Unicode text document in WordPad and re-opening it.

    Joe
    Joe

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Wordpad and Unicode

    Try writing a BOM (Byte Order Mark) at the beginning of the file. Chr(255) followed by Chr(254) denotes little-endian 16 bit encoding.

    FAQ - UTF-8, UTF-16, UTF-32 & BOM

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wordpad and Unicode

    That results in Wordpad inserting FFFE at beginning of file, then all characters are displayed, but therer
    s a blank between each character.

    However, that insertion of the FFFE causes problems for Notepad and Word.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Wordpad and Unicode

    I assume that you meant to reply to me.

    How are you creating the text file? Here is a snippet of VB/VBA code that produces a result that is opened correctly in Notepad, Wordpad and Word on my PC.

    Dim f As Integer
    Dim i As Integer
    f = FreeFile
    Open "test.txt" For Output As #f
    ' Marker
    Print #f, Chr(255);
    Print #f, Chr(254);
    ' Some standard characters
    For i = 1 To 26
    Print #f, Chr(64 + i);
    Print #f, Chr(0);
    Next i
    ' One special character
    Print #f, Chr(65);
    Print #f, Chr(1);
    Close #f

    Note that the low order byte of each character is written after the high order byte (little endian).

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wordpad and Unicode

    bString(0) = 255
    bString(1) = 254
    WriteFile hLog, bString(0), 2, k, ByVal 0&

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wordpad and Unicode

    I recall reading about the BOM sometime ago.

    I guess that I rarely use Wordpad because I've never noticed this before.

    I have ASSuMEd, incorrectly, that Wordpad was more capable than Notepad, guess not!

    I've changed 5 programs to use the BOM in the past hour or so.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •