Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
utmcontent opened this issue May 2, 2024 · 1 comment
Labels
state: pending not addressed yet type: bug bug

Comments

@utmcontent
Copy link

utmcontent commented May 2, 2024

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

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()
@utmcontent utmcontent added state: pending not addressed yet type: bug bug labels May 2, 2024
@utmcontent
Copy link
Author

@ v-ein
#2261
#1158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: pending not addressed yet type: bug bug
Projects
None yet
Development

No branches or pull requests

1 participant