"""
 Much code from https://github.com/vsergeev/python-periphery/blob/master/periphery/pwm.py
 Copyright (c) 2015-2016 vsergeev / Ivan (Vanya) A. Sergeev
 """
 Much code from https://github.com/vsergeev/python-periphery/blob/master/periphery/pwm.py
 Copyright (c) 2015-2016 vsergeev / Ivan (Vanya) A. Sergeev
-                    os.path.join(channel_path, self._export_path), "w"
+                    os.path.join(channel_path, self._export_path), "w", encoding="utf-8"
 
         # Look up the period, for fast duty cycle updates
         self._period = self._get_period()
 
         # Look up the period, for fast duty cycle updates
         self._period = self._get_period()
         except Exception as e:
             # due to a race condition for which I have not yet been
             # able to find the root cause, deinit() often fails
         except Exception as e:
             # due to a race condition for which I have not yet been
             # able to find the root cause, deinit() often fails
             f_attr.write(value + "\n")
 
     def _read_pin_attr(self, attr):
             f_attr.write(value + "\n")
 
     def _read_pin_attr(self, attr):