<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=koi8-r>
<META content="MSHTML 6.00.6001.18203" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" leftMargin=0
topMargin=0 CanvasTabStop="true" name="Compose message area">
<DIV><FONT face=Calibri>Hello</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>I'm use IronPython 2.0.1 as embedded interpreter for
read data from database.</FONT></DIV>
<DIV><FONT face=Calibri>Code for create Engine:</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT
face=Calibri>
fEngine =
Python.CreateEngine();<BR>
Ops =
fEngine.CreateOperations();<BR>
// core
libs<BR>
fEngine.Runtime.LoadAssembly(typeof(Decimal).Assembly);
<BR>
fEngine.Runtime.LoadAssembly(typeof(IValue).Assembly);
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT
face=Calibri>
// loading ADO.NET driver
assemblies<BR>
LoadAssemblies(from v in EtlBaseCfg.BaseCfg.Element("dlls").Elements("dll")
select v.Value);</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>After that, I use generated Ipy class for read one value
from specific IDbDataReader:</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>from ETL.Common.pipes import IValuePipe<BR>class
SelectExtractor(IValuePipe):<BR> def
__init__(self,adoreader,originId,storage):<BR>
self._name = originId<BR> self._reader
= adoreader<BR> self._idx =
adoreader.GetOrdinal(self._name)<BR>
self._transport = storage<BR> def Do(self,
pydict):<BR> val =
self._transport.Clone()<BR> if not
self._reader.IsDBNull(self._idx):<BR>
val.Data =
self._reader.GetString(self._idx)<BR>
if
pydict.ContainsKey(self._name):<BR>
pydict[self._name] = val<BR>
else:<BR>
pydict.Add(self._name,val)</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>This operation return string with Russian symbols
and I get Exception: "'ascii' codec can't decode byte 0 in position 0:
ordinal not in range"</FONT></DIV>
<DIV><FONT face=Calibri>How I can enable unicode .NET strings ?</FONT></DIV>
<DIV><FONT face=Calibri>Looks like I not initialize IronPython correctly,
because this code in Ipy console work fine with Russian charset (Russian
Windows), but not sure about other charsets. I need use .NET unicode
strings.</FONT></DIV>
<DIV><FONT size=2>
<P></FONT><FONT face=Calibri>Best regards</FONT></P></DIV>
<DIV><FONT face=Calibri>Igor Elyas</FONT></DIV></BODY></HTML>