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

Michael Foord fuzzyman at voidspace.org.uk
Fri May 16 00:18:55 CEST 2008

Ulrich Eck wrote:
> 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/SystemString
> 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 
> pythonnet
> with mono within a linux/ubuntu server to access the itext library.
> basically everything is working - except that there is a problem with 
> german
> 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 ?

IronPython basically doesn't have a string implementation at all - you 
use native .NET strings (which correspond to Python Unicode strings)...

Michael Foord

> any hints would be greatly appreciated
> thanks!
> yours Ulrich Eck
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet

More information about the PythonDotNet mailing list