On Mar 29, 2008, at 12:01 AM, Mark O'Neill wrote:
> Well, I'm not sure why that "not" character kept appearing before the
> © symbol, (could it be an RB bug in 2007r4?) but as I needed a "Text
> To HTML Code" function for another part of my program, I've used that
> routine to convert the string to html-safe code. So from the above
> example, the string on file now looks like:
Boy, I sure can't duplicate that on my machine,a Mac using RB2008R1.
I wrote a little program with a window with three statictext fields
and three pushbuttons labeled Binary, PString and Text. Each
pushbutton creates a different file placing your string,
"CopyrightText=©", into it and then reads it back out. I cannot see a
not symbol(¬) when viewing any of the 3 files in BBEdit nor does it
appear in the corresponding statictext field in the window after the
corresponding pushbutton is clicked.
Here is the code for the three pushbutton action events
pbBinary pushbutton
===================
Dim f As FolderItem
Dim bs As BinaryStream
Dim sInput, sOutput As String
Dim lng As UInt32
f = GetFolderItem("BinaryFile")
if f = nil then
beep
MsgBox "Unable to get FolderItem to BinaryFile"
return
end if
if f.exists then
bs = f.OpenAsBinaryFile(True)
else
bs = f.CreateBinaryFile("whatever")
end if
sOutput = "CopyrightText=©"
lng = lenb(sOutput)
bs.WriteUInt32 lng // write out string length
bs.Write sOutput // write out the string
bs.Position = 0 // reposition to start of file
lng = bs.ReadUInt32 // read in string length
sInput = bs.Read(lng, encodings.UTF8) // read in the string
bs.Close
stBinary.Text = sInput // display string read in
ppbPString pushbutton
=====================
Dim f As FolderItem
Dim bs As BinaryStream
Dim sInput, sOutput As String
Dim lng As UInt32
f = GetFolderItem("PStringFile")
if f = nil then
beep
MsgBox "Unable to get FolderItem to PStringFile"
return
end if
if f.exists then
bs = f.OpenAsBinaryFile(True)
else
bs = f.CreateBinaryFile("whatever")
end if
sOutput = "CopyrightText=©"
bs.WritePString sOutput // write out string as a PString
bs.Position = 0 // reposition to start of file
sInput = bs.ReadPString(encodings.UTF8) // read in the string
bs.Close
stPString.Text = sInput // display string read in
pbText pushbutton
=================
Dim f As FolderItem
Dim tOut As TextOutputStream
Dim tIn As TextInputStream
Dim s As String
f = GetFolderItem("TextFile")
if f = nil then
beep
MsgBox "Unable to get FolderItem to TextFile"
return
end if
tOut = f.CreateTextFile
tOut.WriteLine("CopyrightText=©") // write out the string
tOut.Close
tIn = f.OpenAsTextFile
tIn.Encoding = Encodings.UTF8
s = tIn.ReadAll // read in the string
tIn.Close
stText.Text = s // display the string
=== A Mac addict in Tennessee ===
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|