Skip to content

Commit f2b65ad

Browse files
committed
Read .gr file, convert to utf-8:
1 parent c92fdd8 commit f2b65ad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: src/diffpy/srmise/pdfdataset.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,10 @@ def read(self, filename):
202202
self
203203
"""
204204
try:
205-
self.readStr(open(filename, "rb").read())
205+
# Open the file in binary mode, read it, and decode to convert bytes to string
206+
with open(filename, "rb") as file:
207+
file_content = file.read().decode('utf-8')
208+
self.readStr(file_content)
206209
except PDFDataFormatError as err:
207210
basename = os.path.basename(filename)
208211
emsg = ("Could not open '%s' due to unsupported file format " + "or corrupted data. [%s]") % (

0 commit comments

Comments
 (0)