Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.
This repository was archived by the owner on May 18, 2019. It is now read-only.

UCS-2 BE & LE model encoding breaks script #37

@le717

Description

@le717

As originally reported in #36 (comment):

Hi
Sorry to bother you again.
I have fixed some other problem and now was playing with the export to Blender again.
But suddenly I get these errors in the consol window in Blender

[LDR Importer] ERROR: Reason: UnicodeDecodeError. - 17:43:28
[LDR Importer] Attempting to import C:\temp\DS Exp 2013_00001.ldr - 17:43:42
[LDR Importer] ERROR: UnicodeDecodeError
Traceback (most recent call last):
File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\addons\import_ldraw.py", line 766, in create_model
LDrawFile(context, file_name, mat)
File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\ addons\import_ldraw.py", line 126, in __init__
self.parse(filename)
File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\addons\import_ldraw.py", line 244, in parse
lines = f_in.readlines()
File "C:\Program Files\Blender Foundation\Blender\2.68\python\lib\codecs.py", line 300, in decode (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 92: invalid start byte - 17:43:42
[LDR Importer] ERROR: Reason: UnicodeDecodeError. - 17:43:42

I have restarted blender, reexported the file but stil I get this problem right a way after select the file and start.

I also have got the Lsynth to work with the export. I needed to copy the Lsynth parts files to Ldraw\parts dir.
May be something for later that it check the unofficial\Lsynth catalog if it cant find the file in main Ldraw dirs ?

Petter

This is caused by the model saved in UCS-2 encoding.

Fix

Update the script to read models in this encoding. Detect UCS-2BE, UCS-2LE, or standard UTF-8 encoding and return value for proper reading by open().

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions