[Python.NET] passing unicode strings to dotnet-library using mono on ubuntu

Ulrich Eck lists at net-labs.de
Thu May 15 23:56:25 CEST 2008

Hi there,

i'm working with pyhtonnet to use features from itextsharp ( a dotnet  
pdf library).

the purpose of the app is to fill out pdf forms from within a  
turbogears appserver.

i tried several combinations of encodings and passing str/unicode/ 
types to a utility function that sets the current pdf-form value with  
no success.

i wrote a c# sample app that loads utf-8 encoded data and processes  
the pdf.
then i ported it to ironpython with no problem (selecting data from  
sql-db and
setting form-values in the pdfstamper).

due to the lack of several essential std-lib modules i decided to use  
with mono within a linux/ubuntu server to access the itext library.

basically everything is working - except that there is a problem with  
umlauts when passing values from result-sets to the dotnet library.

the library methods dont accept pure str objects .. when i use unicode  
(correctly encoded)
or SystemString objects the non-ascii chars wont display in the pdf or  
the resulting
pdf is invalid (probably due to wrong encoding).

i know that ironpython has a different string implementation .. is  
there a way how i can
access the dotnet library that behaves similar to ironpythons  
implementation ?

any hints would be greatly appreciated


yours Ulrich Eck

More information about the PythonDotNet mailing list