ghammad / pyActigraphy

Python-based open source package for actigraphy data analysis

Home Page:https://ghammad.github.io/pyActigraphy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support different file encodings for RPX files

ugGit opened this issue · comments

Objective

Read RPX files having a different encoding than utf-8 (e.g., cp1252).

Current Behavior

>>> pyActigraphy.io.read_raw_rpx(rpx_file_in_cp1252, language='FR')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 15: invalid start byte

Expected Behavior

>>> pyActigraphy.io.read_raw_rpx(rpx_file_in_cp1252, language='FR', file_encoding='cp1252')
<pyActigraphy.io.rpx.rpx.RawRPX object at 0x000001E8E0B53100>

Suggested Solution

Add an additional file_encoding argument to read_raw_rpx(). The argument is then subsequentially passed to all methods called in the RawRPX class.