Newsgroups: borland.public.delphi.winapi
From: "Peter Below (TeamB)" <100113.1...@compuXXserve.com>
Date: 2000/08/16
Subject: Re: How do I open a text file with Unicode encoding? (Should've asked this before.)
In article <399994eb_2@dnews>, Samuel A. Winchenbach wrote: It is the recommended way to start a unicode text file, and documented in > P.S. Can anyone (read Peter Below) tell me where the ByteOrderMark := 65279 > comes from? win32.hlp (topic "Byte-order Mark"). Its purpose is to handle UNICODE files written on other platforms that use a different byte order (big-endian instead of the Intel little-endian). If you read the first word of a UNICODE file and see that it is $FFFE instead of $FEFF you know that you have to swap the bytes in each word you read to get a valid Widechar for your platform. Delphi has a Swap function that performs this byte order switch. So if you read a UNICODE file you have to be prepared to deal with files that Your routine could be modified to deal with this like follows (untested): Procedure SwapBytesInWideString( Var ws: WideString ); procedure TMainForm.Open1Click(Sender: TObject); Peter Below (TeamB) 100113.1...@compuserve.com) You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||