Unicode

Peter Haworth pete at lcsql.com
Tue Jan 27 13:02:48 EST 2015


Hi Devin,
That works perfectly in pre 7 and 7, thanks a lot.

It's somewhat of a pain to deal with this when putting data into a datagrid
since it requires a custom column behavior to format the data correctly.  I
haven't tried editing a datagrid cell with unicode in it yet, but I'm
guessing that will require some custom coding too.

It seems like there should be a datagrid column property by now that
indicates whether translation to/from unicode is required, especially in 7
since that's its focus.  Similar to your idea of a stack property I guess.

I did find one other motivation to move to 7.0 for unicode.  It seems you
can't copy/paste a unicode string into the pre 7 script editor, you just
end up with question marks.  In 7, it pastes correctly.

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>

On Tue, Jan 27, 2015 at 7:50 AM, Devin Asay <devin_asay at byu.edu> wrote:

>
> On Jan 26, 2015, at 5:35 PM, Peter Haworth <pete at lcsql.com> wrote:
>
> > Well I guess I spoke too soon :-)  When I said I had things working, I
> > meant I could successfully get data from a UTF8 database and display it
> > correctly.
> >
> > I'm now trying to get input from field controls and get it into the
> > database.  I found a lorem ipsum generator that would create text in
> > various languages to I got some Russian text from it and pasted it into
> an
> > LC field.
> >
> > In my handler, I need to put the contents of the field into a variable
> and
> > then hand it off from there to an INSERT statement. I've tried every
> > combination of unicodeText, uniencode, unidecode, or none of the above to
> > get the correct value into the variable but it either ends up as question
> > marks or something that looks nothing like the characters in the field.
> >
> > This is all with pre 7.0.  I think I'm beginning to understand why 7.0
> is a
> > lot better to use than pre 7.0 when heavy unicode handling is needed!
> >
> > But in the meantime, how should I be handling the above situation in pre
> > 7.0?
> >
>
> Pete,
>
> I’ve done this a lot pre-7. Here’s the relevant bit of code:
>
>   put unidecode(the unicodeText of line 1 of fld “russStuff","utf8") into
> tRussTxt
>
> At that point, since the text in tRussTxt is expressed in plain ASCII you
> can just INSERT it or UPDATE your database. To get it out again you reverse
> the process:
>
>   set the unicodeText of fld “russStuff” to
> uniencode(tRussFldFromDB,”utf8”)
>
> LC 7 of course simplifies this process, but you still have to
> textEncode/textDecode the text as you’re outputting/inputting it.
>
>   put textEncode(the text of fld “russStuff”,”utf8”) into tRussTxt # prep
> for DB
>
>   put textDecode(tRussFldFromDB,”utf8”) into fld “russStuff”  # display
> text from DB
>
> HTH
>
> Devin
>
>
> Devin Asay
> Office of Digital Humanities
> Brigham Young University
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list