RubyMarshal icon indicating copy to clipboard operation
RubyMarshal copied to clipboard

'unicodeescape' codec can't decode bytes in position 362-364: truncated \UXXXXXXXX escape

Open SurpassHR opened this issue 10 months ago • 0 comments

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)

Scripts.rxdata

SurpassHR avatar Apr 17 '25 15:04 SurpassHR