<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic python encoding problem? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-encoding-problem/m-p/732461#M56831</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, I know that this theme was discussed few times, but I didnt solve the problem using informations that I've found here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is (for many of you well known) problem with coding. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;type 'exceptions.UnicodeEncodeError'&amp;gt;: 'ascii' codec can't encode character u'\xa0' in position 11: ordinal not in range(128)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I enter ID number (data type &lt;/SPAN&gt;&lt;STRONG&gt;string&lt;/STRONG&gt;&lt;SPAN&gt;) but the script ends with error. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried .encode('utf-8'), .replace(u'\xa0', ' ') but it was no solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First - problematic - part of the script is below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, sys, os, shutil
from arcpy import env

arcpy.env.overwriteOutput = True

obecJmeno = arcpy.GetParameter(0)
adr_puvodni = u"C:\\vydej2\\mapy_!empty_2013"
adr_nove="C:\\vydej2\\Data_Export\\mapy_"+obecJmeno+"_2013"
vyberZ=arcpy.GetParameter(1)
ID=arcpy.GetParameter(2)
if vyberZ=="obec":
&amp;nbsp;&amp;nbsp;&amp;nbsp; vyber= "C:\\vydej2\\Data\\CZ020STCE11obc_poly.shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sqlstat= "\"KOD_OBC_TX\"=" + "'" + ID+ "'"
elif vyberZ=="opu":
&amp;nbsp;&amp;nbsp;&amp;nbsp; vyber= "C:\\vydej2\\Data\\CZ020STCE11opu_poly.shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sqlstat= "\"KOD_OPU_TX\"=" + "'" + ID+ "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; etc
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Btw - this script was fully working yesterday on my collegues computer. Today it doesnt work at his PC as well as at mine. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS 10.0 build 4400&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:51:39 GMT</pubDate>
    <dc:creator>LiborHladis</dc:creator>
    <dc:date>2021-12-12T16:51:39Z</dc:date>
    <item>
      <title>python encoding problem?</title>
      <link>https://community.esri.com/t5/python-questions/python-encoding-problem/m-p/732461#M56831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, I know that this theme was discussed few times, but I didnt solve the problem using informations that I've found here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is (for many of you well known) problem with coding. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;type 'exceptions.UnicodeEncodeError'&amp;gt;: 'ascii' codec can't encode character u'\xa0' in position 11: ordinal not in range(128)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I enter ID number (data type &lt;/SPAN&gt;&lt;STRONG&gt;string&lt;/STRONG&gt;&lt;SPAN&gt;) but the script ends with error. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried .encode('utf-8'), .replace(u'\xa0', ' ') but it was no solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First - problematic - part of the script is below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, sys, os, shutil
from arcpy import env

arcpy.env.overwriteOutput = True

obecJmeno = arcpy.GetParameter(0)
adr_puvodni = u"C:\\vydej2\\mapy_!empty_2013"
adr_nove="C:\\vydej2\\Data_Export\\mapy_"+obecJmeno+"_2013"
vyberZ=arcpy.GetParameter(1)
ID=arcpy.GetParameter(2)
if vyberZ=="obec":
&amp;nbsp;&amp;nbsp;&amp;nbsp; vyber= "C:\\vydej2\\Data\\CZ020STCE11obc_poly.shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sqlstat= "\"KOD_OBC_TX\"=" + "'" + ID+ "'"
elif vyberZ=="opu":
&amp;nbsp;&amp;nbsp;&amp;nbsp; vyber= "C:\\vydej2\\Data\\CZ020STCE11opu_poly.shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sqlstat= "\"KOD_OPU_TX\"=" + "'" + ID+ "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; etc
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Btw - this script was fully working yesterday on my collegues computer. Today it doesnt work at his PC as well as at mine. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS 10.0 build 4400&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:51:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-encoding-problem/m-p/732461#M56831</guid>
      <dc:creator>LiborHladis</dc:creator>
      <dc:date>2021-12-12T16:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: python encoding problem?</title>
      <link>https://community.esri.com/t5/python-questions/python-encoding-problem/m-p/732462#M56832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You provided no specifics as to how you were getting the parameters - command line, script tool, modelbuilder, etc???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suggest trying arcpy.GetParameterAsText(), which gives you a string representation instead of an object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Text is often much easier to work with (for one thing, you can print it out and look at it with repr() -- so you can at least see what you have).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 12:59:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-encoding-problem/m-p/732462#M56832</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2013-09-25T12:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: python encoding problem?</title>
      <link>https://community.esri.com/t5/python-questions/python-encoding-problem/m-p/732463#M56833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried to use arcpy.GetParameterAsText()&amp;nbsp; but result is still the same. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From my opinion the problem is in dbf coding (cp1250) because when I have script without parameters and run it in Python shell, it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was getting the parameters using script tool. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am new in python so maybe I didn't write some important things...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 13:26:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-encoding-problem/m-p/732463#M56833</guid>
      <dc:creator>LiborHladis</dc:creator>
      <dc:date>2013-09-25T13:26:15Z</dc:date>
    </item>
  </channel>
</rss>

