hoffstadt / hoffstadt/DearPyGui

STB to support UTF-8, it needs to be built with the `STBI_WINDOWS_UTF8` define

Open
#2,327 1 comment 0 reactions 0 assignees View on GitHub
state: pending type: bug
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

## Version of Dear PyGui

Version: 1.11.1
Operating System: XXX (Windows 11)

## My Issue/Question
@v-ein reply on discord
Okay so I digged in a bit and it turns out that for STB to support UTF-8, it needs to be built with the `STBI_WINDOWS_UTF8` define. I've added `-DSTBI_WINDOWS_UTF8` to the build config in my local copy of DPG, and it worked - `load_image` can now load images with non-ASCII paths.

Definitely go ahead and open a ticket on GitHub.

## To Reproduce
@v-ein reply on discord
You can open a ticket on GitHub. I've just tried `load_image` on a non-ASCII path - doesn't work for me either, even though it should (it uses STB under the cover, which seems to be UTF-8 aware).

## Expected behavior
`viewport` title will output mess code for non-ASCII characters
`output_frame` filename will output mess code for non-ASCII characters
`load_image` filename
`save_image` filename
`file_dialog` will show ????? for non-ASCII characters

will save or show non-ASCII correctly

## Screenshots/Video
@v-ein reply on discord
You can open a ticket on GitHub. I've just tried `load_image` on a non-ASCII path - doesn't work for me either, even though it should (it uses STB under the cover, which seems to be UTF-8 aware).

Okay so I digged in a bit and it turns out that for STB to support UTF-8, it needs to be built with the `STBI_WINDOWS_UTF8` define. I've added `-DSTBI_WINDOWS_UTF8` to the build config in my local copy of DPG, and it worked - `load_image` can now load images with non-ASCII paths.

Definitely go ahead and open a ticket on GitHub.

## Standalone, minimal, complete and verifiable example

```python
import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport(tilte=non_ASCII_chars)
main_window_tag=dpg.generate_uuid()
with dpg.window(tag=main_window_tag):
image_file_name_with_non_ASCII=non_ASCII_chars+".png" #Use filename with non-ASCII characters on windows
print (image_file_name_with_non_ASCII)
dpg.split_frame()
dpg.split_frame()
dpg.output_frame_buffer(file=image_file_name_with_non_ASCII)
dpg.split_frame()
dpg.split_frame()
dpg.file_dialog() #load paths with non-ASCII characters will show ???????
dpg.load_image(file=image_file_name_with_non_ASCII) filename cannot be non-ASCII characters
dpg.save_image(file=image_file_name_with_non_ASCII) filename cannot be non-ASCII characters

dpg.set_primary_window(main_window_tag,True)
dpg.configure_item(main_window_tag,horizontal_scrollbar=True)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.