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.utf8Validate issue ? #351

Open
passenger94 opened this issue Oct 19, 2022 · 5 comments
Open

Unicode.utf8Validate issue ? #351

passenger94 opened this issue Oct 19, 2022 · 5 comments

Comments

@passenger94
Copy link

passenger94 commented Oct 19, 2022

Hi,
Many thanks for your work !!!

just used the utf8Validate function in glib/Unicode.d module

public static bool utf8Validate(string str, out string end)

In my understanding end should be made of the chars from start of str to outend, outend beeing the first invalid char in str or pointing after the last char of str if valid.
At the moment the function is "returning" the chars from outend to the end of str or nothing.

public static bool utf8Validate(string str, out string end)
{
    char* start = Str.toStringz(str), outend = null;

    auto __p = g_utf8_validate(start, cast(ptrdiff_t)str.length, &outend) != 0;

    end = Str.toString(start, outend - start);

    return __p;
}
	
unittest
{
    string valid;
    bool success = Unicode.utf8Validate("random text", valid);
    assert(success);
    assert(valid == "random text");
    success = Unicode.utf8Validate("random \xc3\x28text", valid);
    assert(!success);
    assert(valid == "random ");

    success = Unicode.utf8ValidateLen("random text", valid);
    assert(success);
    assert(valid == "random text");
    success = Unicode.utf8ValidateLen("random \xc3\x28text", valid);
    assert(!success);
    assert(valid == "random ");
}

Same goes for utf8ValidateLen() as seen in the unittest.
(code is a fixed proposal - for brevity passing tests with non literal string were omitted )

Did i miss something ?
Cheers

@EsoCoding
Copy link

EsoCoding commented Jan 12, 2023

Think this project is not alive anymore. Last commits are from a years ago. We are trying to bring it back alive on a fork from gtkd and going to continue its development and make gtkd more interesting for gnome developers by following the gnome guidelines. Still lots of work to do. So if anyone wants to help contribute and bring back alive gtkd then visit the new git with name gtk-d. I am planning to launch a website soon, build more examples and library's build a composite template for gtk-d etc.

https://github.com/gtk-d/gtk-d

@passenger94
Copy link
Author

Many Thanks !!

@dejlek
Copy link

dejlek commented Feb 2, 2023

@EsoCoding , why did you not simply ask to join the gtkd-developers group? Maybe there is no need to fork the project...

@EsoCoding
Copy link

EsoCoding commented Feb 2, 2023

Have been trying to get in contact, but even posting a simple issue wont be answered. The repo here has not been updated in a long time. Which is the case with many other d library's and programs. I really like D but gtk is requirement for me and my projects. But without active development i may get trouble in the future. So thats why i took the matter in my own hands and now working on making gtk-d ready for gnome-builder. So it may get more interest from the new and interested developers. In the end its just a fork and if i am ready, i will surely try commit my work but i doubt it will be merged. Look at the really great work konstantIMP has done, his work should already have been merged a long time ago. He has been faf ahead of gtkd, and even came up with some really new good ideas, but sadly his work is hard to find. So i am going to promoting he's work now preparing to add D language and gtkd into gnome builder. I think D is a underestimated language and gtkd can be a door to this language.

@hrauchgh
Copy link

Where has your fork gone? I just wanted to look at your new gtk-d repo, but I get a 404 when I use the link you mentioned above.

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

No branches or pull requests

4 participants