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

Unicode Support #188

Closed
hassandraga opened this issue Sep 1, 2023 · 7 comments
Closed

Unicode Support #188

hassandraga opened this issue Sep 1, 2023 · 7 comments
Labels
question Further information is requested

Comments

@hassandraga
Copy link
Member

WebUI does not support Unicode right now. If the local file name, HTML content or any string is encoded in a multi-byte format like UTF8, it won't show proper characters in most cases. We can update all WebUI APIs from char* to wchar_t* beside all the needed core changes. This will make WebUI support Unicode.

If we did this, some wrappers probably need updates to make strings multi-byte instead of one-byte format (ASCII). Before I process this, I would like to know your thoughts.

V Unicode
Nim Unicode
TypeScript Unicode
Python Unicode
Pascal Unicode
Go Unicode

@hassandraga hassandraga added the question Further information is requested label Sep 1, 2023
@ttytm

This comment was marked as outdated.

@ttytm
Copy link
Member

ttytm commented Sep 26, 2023

Coming back to this. What kind of use-case would this serve?

#include "webui.h"

int main() {
    size_t my_window = webui_new_window();
    webui_show(my_window, "<html><head><script src=\"webui.js\"></script></head>Hello 👋!</html>");
    webui_wait();
    return 0;
}

While the window for the code above would contain: Hello 👋!

#include "webui.h"

int main() {
  size_t my_window = webui_new_window();
  webui_show(my_window, "<html><head><meta charset=\"UTF-8\"><script "
                        "src=\"webui.js\"></script></head>Hello 👋!</html>");
  webui_wait();
  return 0;
}

Just specifying the html charset is enough to correctly display Hello 👋!

@fibodevy

This comment was marked as outdated.

@hassandraga
Copy link
Member Author

Sorry, I wasn't clear enough in my comment.
I know that. That's why I added Unicode Test in examples a while ago.
https://github.com/webui-dev/webui/blob/6a634cc680fd7cf0511536ab7302274991489412/examples/C/serve_a_folder/index.html#L50C15-L50C15

<p>
            Unicode Test:<br><br>
            مرحبًا<br> <!-- Arabic -->
            你好<br> <!-- Chinese -->
            こんにちは <!-- Japanese -->
        </p>

I mean by supporting Unicode in WebUI is to make library able to handl Unicode files name and paths.
This webui_show(win, "/home/ちは/test/こん.html") won't works right now.

@ttytm
Copy link
Member

ttytm commented Sep 27, 2023

I see, so it's an issue regarding accessibility and internationalisation.

@hassandraga
Copy link
Member Author

Implemented (42c6e22).

@hassandraga
Copy link
Member Author

FYI: No wrapper changes are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants