import g3pose duf cause unexpected UTF-8 BOM error

Issue #1045 resolved
engetudouiti created an issue

I recently up-date my PC to new one. then now re install and set up all apps which I had used.

then today I try new DAZ importer 1.6 (I almost forget most of detail ,because I have played skyrim SE making MODs long time , so seldom play with Daz figures now ^^;) anyway set up my base scene,then import some G3 poses for default rig, then got this errors. with blender 3.2 and recent beta (GIt version) import daz.

I tried to change global setting for case sensitive, but it seems not help me.

  • i13Foxy 04.duf 1
    JSON error while reading ascii file
    "I:\myfile\dazstudio4\Mylibrary\People\Genesis 3 Female\Poses\i13\Foxy\01 Full Body\i13Foxy 04.duf"
    Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
    WARN (bpy.rna): C:\Users\blender\git\blender-v320\blender.git\source\blender\python\intern\bpy_rna.c:1339 pyrna_enum_to_py: current value '0' matches no enum in 'Scene', 'Scene', 'DazMorphCatsContent'
    WARN (bpy.rna): C:\Users\blender\git\blender-v320\blender.git\source\blender\python\intern\bpy_rna.c:1339 pyrna_enum_to_py: current value '0' matches no enum in 'Scene', 'Scene', 'DazMorphCatsContent'
    ERROR:
    JSON error while reading ascii file
    "I:\myfile\dazstudio4\Mylibrary\People\Genesis 3 Female\Poses\i13\Foxy\01 Full Body\i13Foxy 04.duf"
    Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
    For details see
    'C:\Users\TAKE\Documents\daz_importer_errors.txt'
    Settings file C:/Users/TAKE/import-daz-settings-28x.json saved

  • i13Foxy 08.duf 1
    JSON error while reading ascii file
    "I:\myfile\dazstudio4\Mylibrary\People\Genesis 3 Female\Poses\i13\Foxy\01 Full Body\i13Foxy 08.duf"
    Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
    WARN (bpy.rna): C:\Users\blender\git\blender-v320\blender.git\source\blender\python\intern\bpy_rna.c:1339 pyrna_enum_to_py: current value '0' matches no enum in 'Scene', 'Scene', 'DazMorphCatsContent'
    WARN (bpy.rna): C:\Users\blender\git\blender-v320\blender.git\source\blender\python\intern\bpy_rna.c:1339 pyrna_enum_to_py: current value '0' matches no enum in 'Scene', 'Scene', 'DazMorphCatsContent'
    ERROR:
    JSON error while reading ascii file
    "I:\myfile\dazstudio4\Mylibrary\People\Genesis 3 Female\Poses\i13\Foxy\01 Full Body\i13Foxy 08.duf"
    Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
    For details see
    'C:\Users\TAKE\Documents\daz_importer_errors.txt'

====

I remember this problem had been solved before, but now it seems retur

or did you change option which can manage this problem, somewhere?

Comments (7)

  1. Alessandro Padovani

    Welcome back Enge it’s nice to see you around here.

    I had this issue too some time ago with a couple assets but it was a glitch. I resolved by just re-saving the scene in daz studio before importing. Let me know if this works for you too.

    steps:

    1. export dbz
    2. re-save the duf
    3. import in blender

  2. engetudouiti reporter

    I do not think it is about save scene duf. because it is matter about UTF-Bomb json to import pose file.

    Only way I could solve this issue, I resave all pose.duf as UTF-8 without BOM. I suppose python or blender changed how to treat utf-8 bom json files with utf -8 sig decode.

    Untill Thomas confirm it, I may self convert those utif-8 BOM file (daz vendor seems save it with utf-8 BOM I suppose)

    you may test, any pose.duf file, save as utf-8 BOM (in text editor)

    maybe it cause issue with recent version blender 3.2 I suppose.

    then if utf-8 sig decode (current add on coding way) not work for current blender python, I have subsutitute idea.

    A test import codec

    1. import json
    2. import codecs
    3. json.load(codecs.open('sample.json', 'r', 'utf-8-sig'))

  3. engetudouiti reporter

    in load_json.py

    78 you seems not set encoding as utf_8_sig

    change

    with open(filepath, 'r') as fp:
    to

    with open(filepath, 'r', encoding="utf_8_sig") as fp:

    Then I can load both (UTF-8, or UTF-8 BOM) without problem.

  4. Thomas Larsson repo owner

    Hello engetudouiti, and welcome back. In the latest commit I always use “utf-8-sig” when opening a text file, both for reading and writing. I have a few files around with cyrillic and asian characters, and they seem to work.

  5. engetudouiti reporter

    Thanks quick update . ^^ I suppose maybe utf-8-sig decode should work better for most of case.

  6. Log in to comment