<!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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT 
face=Calibri>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fEngine = 
Python.CreateEngine();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Ops = 
fEngine.CreateOperations();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// core 
libs<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fEngine.Runtime.LoadAssembly(typeof(Decimal).Assembly); 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fEngine.Runtime.LoadAssembly(typeof(IValue).Assembly);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT 
face=Calibri>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// loading ADO.NET driver 
assemblies<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
LoadAssemblies(from v in EtlBaseCfg.BaseCfg.Element("dlls").Elements("dll") 
select v.Value);</FONT></DIV>
<DIV><FONT face=Calibri></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=Calibri>from ETL.Common.pipes import IValuePipe<BR>class 
SelectExtractor(IValuePipe):<BR>&nbsp;&nbsp;&nbsp; def 
__init__(self,adoreader,originId,storage):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self._name = originId<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self._reader 
= adoreader<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self._idx = 
adoreader.GetOrdinal(self._name)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self._transport = storage<BR>&nbsp;&nbsp;&nbsp; def Do(self, 
pydict):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; val = 
self._transport.Clone()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if not 
self._reader.IsDBNull(self._idx):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
val.Data = 
self._reader.GetString(self._idx)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if 
pydict.ContainsKey(self._name):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
pydict[self._name] = val<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
else:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
pydict.Add(self._name,val)</FONT></DIV>
<DIV><FONT face=Calibri></FONT>&nbsp;</DIV>
<DIV><FONT face=Calibri>This operation return string&nbsp;with Russian symbols 
and I get Exception:&nbsp;"'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&nbsp;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>