New topic: 

Storing and retrieving Styled Text Data in Postgres 8.2.3

<http://forums.realsoftware.com/viewtopic.php?t=26111>

       Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic         Author  
Message       fitzbew           Post subject: Storing and retrieving Styled 
Text Data in Postgres 8.2.3Posted: Mon Jan 19, 2009 10:07 am                    
    
Joined: Fri Sep 30, 2005 8:30 am
Posts: 226              I'm using RB 2008r5.1 on OS X.5.6 and working with a 
Postgres Server (version 8.2.3) which is running on a PPC machine on OS X.4.11.

I'm trying to store styled text in the database (Encoding = UTF8).

The db has a table with two fields defined as:
mt_notes as text
mt_notes_style as character varying

To store the styled text, I initially tried something like this:

Code:MyRecordset.Field( "mt_notes" ).Value = MyEditField.Text
MyRecordset.Field( "mt_notes_style" ).Value = MyEditField.TextStyleData


But when I called MyRecordset.Update(), Postgres threw this error:
"ERROR:  invalid byte sequence for encoding "UTF8": 0xcece
HINT:  This error can also happen if the byte sequence does not match the 
encoding expected by the server, which is controlled by "client_encoding".

So, instead I do something like this:
MyRecordset.Field( "mt_notes_style" ).Value = EncodeBase64( 
MyEditField.TextStyleData )

As long as I DecodeBase64() the data after I pull it back out of the DB, this 
works fine on OS X when I later call MyEditField.SetTextAndStyle().

But the above process does NOT work on Windows XP; the app crashes on the 
SetTextAndStyle() call and falls into the Windows error reporting process.

How can I store, retrieve, and apply this styled text data in a cross-platform 
way using Postgres?

Thanks in advance for any help,   
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]     

-- 
Over 900 classes with 18000 functions in one REALbasic plug-in. 
The Monkeybread Software Realbasic Plugin v8.1. 

&lt;http://www.monkeybreadsoftware.de/realbasic/plugins.shtml&gt;

rbforumnotifier@monkeybreadsoftware.de

Reply via email to