Could not open .blend file with chinese in path #35081

Closed
opened 2013-04-26 04:58:39 +02:00 by Harrison Yu · 14 comments

%%%Windows 7 Pro,GTX 580

Blender version with error:2.66 buldbot r56296
and version that worked:2.62

Short description of error:Could not open .blend file with chinese in path

Steps for others to reproduce the error (preferably based on attached .blend file) :
Try to open the blend file in attach files folder.

PS:saving is ok,image file is ok.
%%%

%%%Windows 7 Pro,GTX 580 Blender version with error:2.66 buldbot r56296 and version that worked:2.62 Short description of error:Could not open .blend file with chinese in path Steps for others to reproduce the error (preferably based on attached .blend file) : Try to open the blend file in attach files folder. PS:saving is ok,image file is ok. %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%Tried to reproduce the issue, no luck. Eevn failed to updack the archive -- seems path name is messing up. However, ussing russian (which is also multibyte) letters in paths works just fine.

Anyone succeeded to reproduce the issue?%%%

%%%Tried to reproduce the issue, no luck. Eevn failed to updack the archive -- seems path name is messing up. However, ussing russian (which is also multibyte) letters in paths works just fine. Anyone succeeded to reproduce the issue?%%%
Member

%%%I can reproduce this everyday for months, as well as almost every Chinese Windows blenderers I met. It has been reported similar issues long time ago.

http://projects.blender.org/tracker/index.php?func=detail&aid=32888 (todo?)
http://projects.blender.org/tracker/index.php?func=detail&aid=30751 (not really fixed)
http://projects.blender.org/tracker/index.php?func=detail&aid=30752 (fixed)

Since Linux can deal well with with IME and non-ascii paths now, I think it's more like a OS-related issue. I've attached 2 images to show how weird the character displays in console window.

However, one quite interesting thing is: If you added 5 ASCII characters ( doesn't work if less than 5), it will work. Like what's like on my image. I don't know if this is only for CJK. Some other reference, if helps: http://stackoverflow.com/questions/5865430/cross-platform-input-method-support

To be honest, we are really dreaming for such support!%%%

%%%I can reproduce this everyday for months, as well as almost every Chinese Windows blenderers I met. It has been reported similar issues long time ago. http://projects.blender.org/tracker/index.php?func=detail&aid=32888 (todo?) http://projects.blender.org/tracker/index.php?func=detail&aid=30751 (not really fixed) http://projects.blender.org/tracker/index.php?func=detail&aid=30752 (fixed) Since Linux can deal well with with IME and non-ascii paths now, I think it's more like a OS-related issue. I've attached 2 images to show how weird the character displays in console window. However, one quite interesting thing is: If you added 5 ASCII characters ( doesn't work if less than 5), it will work. Like what's like on my image. I don't know if this is only for CJK. Some other reference, if helps: http://stackoverflow.com/questions/5865430/cross-platform-input-method-support To be honest, we are really dreaming for such support!%%%

%%%I can reproduce the reported issue on Windows Vista x64 with the active code path set to 932 (Japanese Shift_JIS).
Blender cannot open .blend files if they are in a folder whose name starts with a Japanese character.
The error pop-up window shows the full path to a .blend file correctly (including Japanese characters in the path), but Blender fails to open the file.
As Leon reported, .blend files can be loaded without trouble if they are in a folder whose name starts with 5 ASCII characters followed by Japanese characters.

The pop-up window error message "unable to open the file" seems to come from wm_read_exotic()'s return value BKE_READ_EXOTIC_FAIL_OPEN.
This value is returned from wm_read_exotic() only when BLI_gzopen() fails in that function.
Apparently there is something wrong in BLI_gzopen() with regard to gzopen() or GetShortPathNameW() called from there (involving encoding conversions between utf-8 and utf-16 back and forth).

I am not familiar with these Windows specific file name handling, but a solution here could be to rely on gzopen_w() available in zlib 1.2.7.
See the attached gzopen_w.patch to fix the reported issue. With the fix and updated zlib everything looks working well on my side.%%%

%%%I can reproduce the reported issue on Windows Vista x64 with the active code path set to 932 (Japanese Shift_JIS). Blender cannot open .blend files if they are in a folder whose name starts with a Japanese character. The error pop-up window shows the full path to a .blend file correctly (including Japanese characters in the path), but Blender fails to open the file. As Leon reported, .blend files can be loaded without trouble if they are in a folder whose name starts with 5 ASCII characters followed by Japanese characters. The pop-up window error message "unable to open the file" seems to come from wm_read_exotic()'s return value BKE_READ_EXOTIC_FAIL_OPEN. This value is returned from wm_read_exotic() only when BLI_gzopen() fails in that function. Apparently there is something wrong in BLI_gzopen() with regard to gzopen() or GetShortPathNameW() called from there (involving encoding conversions between utf-8 and utf-16 back and forth). I am not familiar with these Windows specific file name handling, but a solution here could be to rely on gzopen_w() available in zlib 1.2.7. See the attached gzopen_w.patch to fix the reported issue. With the fix and updated zlib everything looks working well on my side.%%%

%%%> Windows Vista x64 with the active code path set to 932 (Japanese Shift_JIS)

I meant the active code page (i.e., system locale in Windows).%%%

%%%> Windows Vista x64 with the active code path set to 932 (Japanese Shift_JIS) I meant the active code page (i.e., system locale in Windows).%%%
Author

%%%I did some investigation too(although I not a real coder):
1.Output come from
In this fucntion of "wm_files.c"
static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
the line with:
gzfile = BLI_gzopen(name, "rb");

2.BLI_gzopen function of "fileops.c"
It will call "BLI_get_short_name(short_name, filename);"
before "gzfile = gzopen(filename, mode);"

I think why the first 5 ASCII work is because it still valid after windows shorten path.

make a little printf,the filename and the short_name is:

filename : D:\FileInChinesePathCanNotOpen\娴嬭瘯鐩綍\test.blend
short_name : D:\FILEIN~1\K疹U\TEST~1.BLE

Maybe ENCODE?%%%

%%%I did some investigation too(although I not a real coder): 1.Output come from In this fucntion of "wm_files.c" static int wm_read_exotic(Scene *UNUSED(scene), const char *name) the line with: gzfile = BLI_gzopen(name, "rb"); 2.BLI_gzopen function of "fileops.c" It will call "BLI_get_short_name(short_name, filename);" before "gzfile = gzopen(filename, mode);" I think why the first 5 ASCII work is because it still valid after windows shorten path. make a little printf,the filename and the short_name is: filename : D:\FileInChinesePathCanNotOpen\娴嬭瘯鐩綍\test.blend short_name : D:\FILEIN~1\K疹U\TEST~1.BLE Maybe ENCODE?%%%
Author

%%%I want to try Tamito Kajiyama's patch.
But can you tell me how to update to zlib 1.2.7?%%%

%%%I want to try Tamito Kajiyama's patch. But can you tell me how to update to zlib 1.2.7?%%%

%%%Hi Harrison,
You need to build zlib 1.2.7 from the source. I relied on CMake to build it in the Release configuration (just in the same way with Blender build).
After a successful build, you will get zlib.dll, zlib.lib, and zconf.h in the build directory. You also have zlib.h in the source directory.
Copy library and header files into the lib/windows/zlib/include and lib folders, respectively, by hand (or lib/win64/zlib in case you have 64-bit Windows).
You also need to change the file name of zlib.lib to libz.lib. Then build Blender as usual and install it (to get the DLL updated). That's it.%%%

%%%Hi Harrison, You need to build zlib 1.2.7 from the source. I relied on CMake to build it in the Release configuration (just in the same way with Blender build). After a successful build, you will get zlib.dll, zlib.lib, and zconf.h in the build directory. You also have zlib.h in the source directory. Copy library and header files into the lib/windows/zlib/include and lib folders, respectively, by hand (or lib/win64/zlib in case you have 64-bit Windows). You also need to change the file name of zlib.lib to libz.lib. Then build Blender as usual and install it (to get the DLL updated). That's it.%%%

%%%The patch is correct. I committed it now along with 32 bit zlib libraries, and added an extra check so it keeps compiling on other platforms until zlib has been updated for them.

Now we just need updated 64 bit and mingw libraries.
%%%

%%%The patch is correct. I committed it now along with 32 bit zlib libraries, and added an extra check so it keeps compiling on other platforms until zlib has been updated for them. Now we just need updated 64 bit and mingw libraries. %%%

%%%We now have 64 bit zlib libraries as well, and the (non-experimental) buildbot builds should have the fix:
http://builder.blender.org/download/

Please test if they work for you.%%%

%%%We now have 64 bit zlib libraries as well, and the (non-experimental) buildbot builds should have the fix: http://builder.blender.org/download/ Please test if they work for you.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

%%%Hi Brecht,
Thanks for the commits. I confirm that the updates work fine on my side.%%%

%%%Hi Brecht, Thanks for the commits. I confirm that the updates work fine on my side.%%%
Member

%%%It works fairly well with Chinese character path. Thanks a lot guys!%%%

%%%It works fairly well with Chinese character path. Thanks a lot guys!%%%
Author

%%%It works very well,thank you all!%%%

%%%It works very well,thank you all!%%%
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#35081
No description provided.