# 1. Solution exception:'ascii' codec can't encode character '\\u5B8B' in position 106: ordinal not in range(128)

**URL:** <https://discourse.ladybug.tools/t/1-solution-exception-ascii-codec-cant-encode-character-u5b8b-in-position-106-ordinal-not-in-range-128/13284>\
**Category:** butterfly\
**Created:** [February 22, 2021, 4:41am UTC](https://discourse.ladybug.tools/t/1-solution-exception-ascii-codec-cant-encode-character-u5b8b-in-position-106-ordinal-not-in-range-128/13284 "2021-02-22T04:41:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Disgrace](https://discourse.ladybug.tools/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@Disgrace](https://discourse.ladybug.tools/u/Disgrace)\
**Post date:** [February 22, 2021, 4:41am UTC](https://discourse.ladybug.tools/t/1-solution-exception-ascii-codec-cant-encode-character-u5b8b-in-position-106-ordinal-not-in-range-128/13284/1 "2021-02-22T04:41:26Z")

</div>

I open the offical example gh file,but the component"butterfly\_blockMesh" turns wrong, and it shows “1. Solution exception:‘ascii’ codec can’t encode character ‘\u5B8B’ in position 106: ordinal not in range(128)”.Except my system name has Chinese character ,there is no Chinese character in that file.So how can I solve this problem?

---

<div class="post-metadata">

**Author:** ![nickbonz](https://discourse.ladybug.tools/letter_avatar_proxy/v4/letter/n/5e9695/32.png) [@nickbonz](https://discourse.ladybug.tools/u/nickbonz)\
**Post date:** [September 7, 2021, 7:47pm UTC](https://discourse.ladybug.tools/t/1-solution-exception-ascii-codec-cant-encode-character-u5b8b-in-position-106-ordinal-not-in-range-128/13284/2 "2021-09-07T19:47:29Z")

</div>

Try setting the system default encoding as utf-8 at the start of the script, so that all strings are encoded using that.

Example -

```auto
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

```

The above should set the default encoding as utf-8 .

In most cases, the issue is that when you call str(), python uses the default character encoding to try and encode the bytes you gave it, which in your case are sometimes representations of unicode characters. To fix the problem, you have to tell [python](http://net-informations.com/python/iq/default.htm) how to deal with the string you give it by using .encode(‘whatever\_unicode’). Most of the time, you should be fine using utf-8. So, stop using str() to convert from unicode to encoded text / bytes, properly use .encode() to encode the string:,

`yourstring.encode('utf-8')`

For python 3.x ,there is default encoding, hence there will be no issue of encoding.

---

<div class="post-metadata">

**Author:** ![1770559112](https://discourse.ladybug.tools/letter_avatar_proxy/v4/letter/1/f07891/32.png) [@1770559112](https://discourse.ladybug.tools/u/1770559112)\
**Post date:** [July 30, 2022, 5:31am UTC](https://discourse.ladybug.tools/t/1-solution-exception-ascii-codec-cant-encode-character-u5b8b-in-position-106-ordinal-not-in-range-128/13284/3 "2022-07-30T05:31:58Z")

</div>

Check the input epw file path. If the file path have Chinese character, it will also show the same error.

---

<div class="post-metadata">

**Author:** ![20231991](https://discourse.ladybug.tools/letter_avatar_proxy/v4/letter/2/bc79bd/32.png) [@20231991](https://discourse.ladybug.tools/u/20231991)\
**Post date:** [November 22, 2023, 9:03am UTC](https://discourse.ladybug.tools/t/1-solution-exception-ascii-codec-cant-encode-character-u5b8b-in-position-106-ordinal-not-in-range-128/13284/4 "2023-11-22T09:03:04Z")

</div>

Hi I am also having the following error text what could be the problem? thanks.

1.1. Solution exception:‘ascii’ codec can’t encode character ‘\u131’ in position 189: ordinal not in range(128)
