isl-org / isl-org/Open3D

Bug report: Cannot load .obj file when path contains Korean characters

Open
#7,336 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [x] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [x] For Python issues, I have tested with the [latest development wheel](https://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [x] I have checked the [release documentation](https://www.open3d.org/docs/release/) and the [latest documentation](https://www.open3d.org/docs/latest/) (for `main` branch).

### Describe the issue

When attempting to load an ASCII .obj file using open3d.io.read_triangle_mesh() in a Windows environment, the function fails with a UTF-8 decoding error if the file path contains Korean (Hangul) characters. However, the same file saved as ASCII .ply loads successfully under identical conditions.

### Steps to reproduce the bug

1. Save an ASCII `.obj` file with UTF-8 encoding.
2. Place the file in a directory with Korean characters in the path, e.g., `C:/Users/사용자/샘플/sample.obj`
3. Run the following code:

```python
import open3d as o3d
mesh = o3d.io.read_triangle_mesh("C:/Users/사용자/샘플/sample.obj")
```

4. Observe the error:
```
'utf-8' codec can't decode byte 0xbb in position XX: invalid start byte
```

5. Save the same mesh as `.ply` in ASCII format and load it from the same path:

```python
mesh = o3d.io.read_triangle_mesh("C:/Users/사용자/샘플/sample.ply")
```

6. This works without error.

### Error message

`'utf-8' codec can't decode byte 0xbb in position XX: invalid start byte`

### Expected behavior
Both `.obj` and `.ply` files should load successfully from paths containing non-ASCII characters, assuming the files themselves are properly encoded.

### Actual Behavior
Only `.ply` files load successfully. `.obj` files fail with a UTF-8 decoding error.

### Open3D, Python and System information

```markdown
OS: Windows 10/11 (Korean locale)
Open3D version: 0.19.0
Python version: 3.10
File encoding: UTF-8 (confirmed)
File format: ASCII .obj and .ply
```

### Additional information
- The `.obj` file has been verified to be UTF-8 encoded.
- The issue seems to be related to how Open3D parses `.obj` files internally, possibly involving texture or material references.
- This issue does not occur when the path contains only ASCII characters.

### Suggested Fix
- Ensure that Open3D’s `.obj` parser properly handles Unicode file paths and internal references.
- Consider using wide-character APIs or Python’s `Path` objects with proper encoding handling.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.