adizanni / ExportToHASS

Sweethome3D Plugin for Home Assistant Export
GNU General Public License v3.0
52 stars 5 forks source link

something wrong in obj, mtl and json file when object name contain non-ISO-8859-1 characters #3

Closed sonnyyin closed 3 years ago

sonnyyin commented 3 years ago

This plugin is good 。however, after export obj,mtl,json file use this plugin,there is something wrong in json file,like this

微信截图_20210909000239

in green box,the same two “window” has the same object id in JSON file; and in red box,the 3d model Name field with Chinese characters cannot export correctly,in HA ,the model with materials cannot display or display wrong material image.

微信截图_20210909001942 微信截图_20210909001834

Hope solve this problem in future.

adizanni commented 3 years ago

Hello Sonny,

I have no control on the uniqueness of the names in Sweethome3d. I cannot see the full name of the objects in your Sweethome3d model but I suggest you change the name with something unique (for my models I append the name of the room to the name of the furniture, etc.).

I did not get if the rug is the object that is not exported correctly because the name is chinese. I must say that I have not a lot of experience with code internazionalization but if you send me your model, I can try to reporduce the issue and fix it. From your side I've seen that some of the furniture names are already in english, please try to rename all the object to english names as a temporary workaround before I my fix (that may take a while)

sonnyyin commented 3 years ago

Thanks for reply. I find that , if i set the software language to chinese in preferences, and the 3D model has chinese translation, after drag the model to canvas,the model name will display the default Chinese translation ,even if i change the model name to English,the export json file also not correct. The model without Chinese translation ,the export file seems right . I will upload my sh3d file soon, you can analysis it for this issue . Thanks for you!

myhome1.zip

adizanni commented 3 years ago

I confirm chinese characters string are not managed properly by the export plugin, files are opened in ISO-8859-1 character set. I can try to support UTF-8 encoding to include Chinese in the supported character set, but I need some time and be sure I'm not breaking other functions. Would you be so kind to apply the workaround (only ISO 8859 characters) in the object names ? I do not think it is a big deal, you have to do it only once and anyway you have already english names in your model......

sonnyyin commented 3 years ago

Thanks for your suggestion, i will try it soon.

adizanni commented 3 years ago

I have not much time to spend and for the moment I have decided that I will not support other character set than ISO 8859.