dendibakh / perf-book

The book "Performance Analysis and Tuning on Modern CPU"
https://book.easyperf.net/perf_book
Creative Commons Zero v1.0 Universal
1.99k stars 143 forks source link

Windows build fail with UnicodeDecodeError #54

Closed ganyuo closed 2 days ago

ganyuo commented 1 week ago

The error log:

Traceback (most recent call last):
  File "D:\workspace\perf-book-main\export_book.py", line 74, in <module>
    lines = f.readlines()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 3820: illegal multibyte sequence

the reason is that file encoding is not utf-8. I add the param of encoding="utf-8", it build suceed。

texFile = 'book.tex'
editTexFile = 'book_edit.tex'

with open(texFile, 'r', encoding="utf-8") as f:
    lines = f.readlines()

with open(editTexFile, 'w', encoding="utf-8") as g:
    chapterRefs = []
    prev = ""
dendibakh commented 1 week ago

Hmm, I don't see this problem in my setup. The CI builds it with no issues as well. https://github.com/dendibakh/perf-book/actions/runs/9490575705

ganyuo commented 2 days ago

Hmm, I don't see this problem in my setup. The CI builds it with no issues as well. https://github.com/dendibakh/perf-book/actions/runs/9490575705

Maybe it only happen on Windows operating system.