After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780075 - Added ustring::make_valid() which fixes non-UTF8 strings.
Added ustring::make_valid() which fixes non-UTF8 strings.
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: strings
2.51.x
Other All
: Normal enhancement
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2017-03-15 01:38 UTC by Krzysztof Piecuch
Modified: 2017-03-15 09:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch introducing this method (4.89 KB, patch)
2017-03-15 01:38 UTC, Krzysztof Piecuch
none Details | Review

Description Krzysztof Piecuch 2017-03-15 01:38:40 UTC
Created attachment 347970 [details] [review]
patch introducing this method

make_valid replaces all non-UTF8 characters with replacement character (U+FFFD). Now you can do a lot more with an ustring after ustring::validate() tells you it's not a proper UTF-8 string, like iterating over it or printing it out.

I have attached a patch for current master version which introduces this method.
Comment 1 Murray Cumming 2017-03-15 09:00:13 UTC
Thanks. I have pushed that to glibmm master. I made some changes:

* In the commit message, I mentioned that this wrap g_utf8_make_valid(). I was about to ask you to put this work in glib until I saw that it uses the glib function.
* I corrected the formatting. We used two spaces instead of tabs in the rest of these files.
* I commented out the unused repl_character variable in the tests. Maybe you meant to use this. When we pass --enable-warnings=fatal to autogen.sh, we see warnings such as this.

Thanks again.