[Zope] character encoding

2007-11-09 Thread adam molyneaux

Hi

I am currently having problems sorting out utf8 encoding through the following chain of events, and I would GREATLY 
appreciate any help anyone can offer.  I need to do the following, in a Zope 2.9.2-, python 2.4.3 setup (I have also 
tried this on Zope 2.10.4 with the uniocode patch for MySQLDA and get slightly different equally annoying results).



1. Read and parse a file encoded as utf8 - currently done with an external 
script
2. send it to a page to edit as utf8
3. save it from the page into a mysql database as utf8


This is slightly complicated by the fact that steps 2 and 3 need to happen via XMLHttpRequest calls, and the data is 
sent serialized as JSON


Anyone done anything similar with success ?

Currently when I export stuff from my database for the end client I am having to change %u in the text into \u 
then decode the string as 'latin1', further decode it as 'unicode_escape', then recode it as 'utf8'.


This seems slightly 'dangerous'.

Thanks for any help - this has cost me far too much time already.


Adam

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: how do I get field names from a query

2000-05-31 Thread Adam Molyneaux

still trying to get field names from a query of the form
SELECT * FROM MYTABLE



dtml-in "sqlListTable(table_name='personnel')"
   dtml-in sequence-item
  Pdtml-var sequence_key
/dtml-in 


doesnt seem to work

niether does the How To http://www.zope.org/Members/teyc/howtoSQLVariables
 assuming I have understood it correctly

ie.
dtml-let R="sqlListTable(table_name='personnel')"

   dtml-in SQL.names
 dtml-let vname=sequence-item
   vvalue="SQL()[0][_['sequence-index']]"
dtml-var vname,
dtml-var vvaluebr
 /dtml-let
   /dtml-in
/dtml-let

FINALLY I have succeded in doing what I want by using an external method
which returns the list of fieldname !

ie.
def getFieldNames(self,res):
fieldnames=res._schema.items()
return fieldnames


I would still be interested in knowing how to do the job correctly.

adam
[EMAIL PROTECTED]





___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] how do I get field names from a query

2000-05-30 Thread Adam Molyneaux

how do I get the names of the fields returned from a SQL query ?
( I would like to generate stuff using the names automatically)
I know they must be available because I can use them directly !

I've tried lots of alternatives of the form

dtml-in "sqlListTable(table_name='personnel')"
   dtml-in sequence-item
  Pdtml-var sequence_item
/dtml-in 


which give me the values but not the names, and looked through lots of the
old msgs.

Thanks in advance if anyone can help

adam
[EMAIL PROTECTED]






___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )