RubyMarshal
RubyMarshal copied to clipboard
'unicodeescape' codec can't decode bytes in position 362-364: truncated \UXXXXXXXX escape
Hi, I got an error while reading a .rxdata, 'unicodeescape' codec can't decode bytes in position 362-364: truncated \UXXXXXXXX escape, I solved it by adding extra decoding type latin-1.
207 if in_ivar:
208 # The object has attributes.
209 attributes = self.read_attributes()
210 if token in (TYPE_STRING, TYPE_REGEXP):
211 encoding = self._get_encoding(attributes)
212 try:
213 result = result.decode(encoding)
214 except UnicodeDecodeError:
215 try:
216 result = result.decode("unicode-escape")
217 except:
218 result = result.decode("latin-1")
219 # string instance attributes are discarded (on regex?)
220 if attributes and token == TYPE_STRING:
221 result = RubyString(result, attributes)
222 elif attributes:
223 result.set_attributes(attributes)