rm-hull: py27 build fails because of different unicode/utf-8 handling .. any ideas @thijstriemstra ?
thijstriemstra: oh the (co-)author should be added to contributors?
thijstriemstra: > py27 build fails because of different unicode/utf-8 handling 

let me check.
thijstriemstra: Took another look but can't figure it out, since I'm not sure what 'dot_muncher' does. Perhaps you can comment it line by line in this PR and it'll become more clear.
rm-hull: ### Notes

Seems like python2 doesn't properly iterate over unicode characters (but python 3 does), and this is the root cause of the problem.

* https://stackoverflow.com/questions/46711888/how-to-properly-iterate-over-unicode-characters-in-python

```python
Python 2.7.15 (default, Jun 17 2018, 12:46:58) 
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = "29.12°C"
>>> len(x)
8
>>> list(x)
['2', '9', '.', '1', '2', '\xc2', '\xb0', 'C'] 
>>> y = u"29.12°C"
>>> len(y)
7
>>> list(y)
[u'2', u'9', u'.', u'1', u'2', u'\xb0', u'C']
```

vs.

```python3
Python 3.7.0 (default, Jun 29 2018, 20:13:13) 
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = "29.12°C"
>>> len(x)
7
>>> list(x)
['2', '9', '.', '1', '2', '°', 'C']
```
diff --git a/.gitignore b/.gitignore
index 04ce1c3..92614be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,6 +42,7 @@ htmlcov/
 .cache
 nosetests.xml
 coverage.xml
+.pytest_cache/
 
 # Translations
 *.mo
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 3f474bb..f86c1c5 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -22,3 +22,4 @@ Contributors
 * Qinkang Huang (@pokebox)
 * Shawn Woodford (@swoodford)
 * Phil Howard (@gadgetoid)
+* Petr Kracík (@petrkr)
diff --git a/luma/led_matrix/segment_mapper.py b/luma/led_matrix/segment_mapper.py
index 91c3447..f8e22cf 100644
--- a/luma/led_matrix/segment_mapper.py
+++ b/luma/led_matrix/segment_mapper.py
@@ -6,6 +6,8 @@ _DIGITS = {
     ' ': 0x00,
     '-': 0x01,
     '_': 0x08,
+    u'°': 0x63,
+    '\xb0': 0x63,
     '\'': 0x02,
     '0': 0x7e,
     '1': 0x30,
@@ -86,6 +88,9 @@ def regular(text, notfound="_"):
 
 
 def dot_muncher(text, notfound="_"):
+    if not text:
+        return
+
     undefined = _DIGITS[notfound]
     iterator = iter(text)
     last = _DIGITS.get(next(iterator), undefined)
diff --git a/setup.py b/setup.py
index 60a671d..84fb47a 100644
--- a/setup.py
+++ b/setup.py
@@ -50,7 +50,7 @@ setup(
     url="https://github.com/rm-hull/luma.led_matrix",
     download_url="https://github.com/rm-hull/luma.led_matrix/tarball/" + version,
     packages=["luma", "luma.led_matrix"],
-    install_requires=["luma.core>=1.2.1"],
+    install_requires=["luma.core>=1.8.1"],
     setup_requires=pytest_runner,
     tests_require=test_deps,
     extras_require={

Add degree symbol to charmap
Add degree symbol to charmap, so we can use this library to show temperature.

```diff
diff --git a/luma/led_matrix/segment_mapper.py b/luma/led_matrix/segment_mapper.py
index 91c3447..d6a8e5f 100644
--- a/luma/led_matrix/segment_mapper.py
+++ b/luma/led_matrix/segment_mapper.py
@@ -6,6 +6,7 @@ _DIGITS = {
     ' ': 0x00,
     '-': 0x01,
     '_': 0x08,
+    '°': 0x63,
     '\'': 0x02,
     '0': 0x7e,
     '1': 0x30,
```

![image](https://user-images.githubusercontent.com/6428351/43455412-004f493c-94c0-11e8-9d43-a35c2d056474.png)

diff --git a/tests/test_segment_mapper.py b/tests/test_segment_mapper.py
index c32cf19..7ef4e20 100644
--- a/tests/test_segment_mapper.py
+++ b/tests/test_segment_mapper.py
@@ -62,3 +62,21 @@ def test_regular_empty_buf():
     buf = mutable_string("")
     results = regular(buf)
     assert list(results) == []
+
+
+def test_degrees_string():
+    buf = mutable_string("29.12\xb0C")
+    results = dot_muncher(buf)
+    assert list(results) == [0x6d, 0x7b | 0x80, 0x30, 0x6d, 0x63, 0x4e]
+
+
+def test_degrees_unicode():
+    buf = mutable_string(u"29.12°C")
+    results = dot_muncher(buf)
+    assert list(results) == [0x6d, 0x7b | 0x80, 0x30, 0x6d, 0x63, 0x4e]
+
+
+def test_degrees_utf8():
+    buf = mutable_string(u"29.12\xb0C")
+    results = dot_muncher(buf)
+    assert list(results) == [0x6d, 0x7b | 0x80, 0x30, 0x6d, 0x63, 0x4e]

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov
apt-get update apt-get install -y build-essential python3-dev libfreetype6-dev libjpeg-dev
3.9
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
cbor2==5.6.5
coverage==7.8.0
exceptiongroup==1.2.2
iniconfig==2.1.0
luma.core==2.4.2
-e git+https://github.com/rm-hull/luma.led_matrix.git@8b9323d8272d4789bbcef9b031573fa582cfcc23#egg=luma.led_matrix
packaging==24.2
pillow==11.1.0
pluggy==1.5.0
pyftdi==0.56.0
pyserial==3.5
pytest==8.3.5
pytest-cov==6.0.0
pyusb==1.3.1
RPi.GPIO==0.7.1
smbus2==0.5.0
spidev==3.6
tomli==2.2.1

name: luma.led_matrix
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - cbor2==5.6.5
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - iniconfig==2.1.0
      - luma-core==2.4.2
      - packaging==24.2
      - pillow==11.1.0
      - pluggy==1.5.0
      - pyftdi==0.56.0
      - pyserial==3.5
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pyusb==1.3.1
      - rpi-gpio==0.7.1
      - smbus2==0.5.0
      - spidev==3.6
      - tomli==2.2.1
prefix: /opt/conda/envs/luma.led_matrix

tests/test_segment_mapper.py::test_dot_muncher_empty_buf tests/test_segment_mapper.py::test_degrees_string tests/test_segment_mapper.py::test_degrees_unicode tests/test_segment_mapper.py::test_degrees_utf8
tests/test_segment_mapper.py::test_dot_muncher_without_dots tests/test_segment_mapper.py::test_dot_muncher_with_dot tests/test_segment_mapper.py::test_dot_muncher_with_dot_at_end tests/test_segment_mapper.py::test_dot_muncher_with_multiple_dot tests/test_segment_mapper.py::test_regular_without_dots tests/test_segment_mapper.py::test_regular_with_dot tests/test_segment_mapper.py::test_regular_with_multiple_dot tests/test_segment_mapper.py::test_regular_empty_buf
setup.py .gitignore luma/led_matrix/segment_mapper.py CONTRIBUTING.rst
setup.py .gitignore luma/led_matrix/segment_mapper.py CONTRIBUTING.rst