<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.inkscape.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Filenames</id>
	<title>Filenames - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.inkscape.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Filenames"/>
	<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=Filenames&amp;action=history"/>
	<updated>2026-06-02T11:09:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=Filenames&amp;diff=122568&amp;oldid=prev</id>
		<title>Tavmjong: Created page with &quot;Filenames should be std::strings but presented as Glib::ustings (UTF8) in GUI elements. Glib has functions to convert back and forth. All Glib file utility functions take and...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=Filenames&amp;diff=122568&amp;oldid=prev"/>
		<updated>2023-10-10T11:15:36Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Filenames should be std::strings but presented as Glib::ustings (UTF8) in GUI elements. Glib has functions to convert back and forth. All Glib file utility functions take and...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Filenames should be std::strings but presented as Glib::ustings (UTF8) in GUI elements. Glib has functions to convert back and forth. All Glib file utility functions take and return std::strings (other than those converting between types). We use these functions throughout our code, often ignoring implicit conversions between std::string and Glib::ustring (or UTF8 encoded and not-encoded strings of type char*).&lt;br /&gt;
&lt;br /&gt;
== Gtk4 Changes ==&lt;br /&gt;
&lt;br /&gt;
Gtk4 makes several changes that impact our use of strings:&lt;br /&gt;
&lt;br /&gt;
=== Use of Glib::StdStringView and Glib::UStringView ===&lt;br /&gt;
&lt;br /&gt;
Many functions take these types as arguments. It's an error to mix them.&lt;br /&gt;
&lt;br /&gt;
# Glib::StdStringView : Different from std::string_view in that only holds null-terminated strings. One can pass in a Glib::ustring via Glib::ustring::c_str().&lt;br /&gt;
# Glib::UStringView : UTF8 encoded string. One can pass in a std::string using std::string::c_str().&lt;br /&gt;
&lt;br /&gt;
=== Return Gio::File rather than filenames (std::strings) in File dialogs ===&lt;br /&gt;
&lt;br /&gt;
Gio::Files handle std::string/Glib::ustrings properly. We should be using them and have some code that already does.&lt;br /&gt;
&lt;br /&gt;
== Updating Our Code ==&lt;br /&gt;
&lt;br /&gt;
This is quite messy. Our code file handling code is divided over many file:&lt;br /&gt;
&lt;br /&gt;
* src/file.h: Several file opening functions (that should be removed). Calls document_new in inkscape-application.h. Also contains Import dialog (should be moved). Calls Extension::Open.&lt;br /&gt;
* src/inkscape-application.h: Functions for opening documents and creating windows. Calls ink_file_new, ink_file_open(data), ink_file_open(Gio::File) in io/file.h.&lt;br /&gt;
* src/io/file.h: Functions ink_file_new, ink_file_open. Calls SPDocument::createNewDoc() or SPDocument::createNewDocFromMem() in src/document.h&lt;br /&gt;
* src/document.h: Functions for creating documents by first creating the XML via calling sp_rper_read_file(filename, SP_SVG_NS_URI), sp_repr_document_new(&amp;quot;svg:svg&amp;quot;), sp_repr_read_mem(char const* buffer...)&lt;br /&gt;
* src/xml/repr.h (repr-io.cpp): Functions that use libxml2 to extract out the XML tree from files.&lt;br /&gt;
&lt;br /&gt;
* src/extension/internal/xxx: Functions to open various file types.&lt;br /&gt;
* src/extension/internal.svg.h: Open SVG files: calls functions in src/document.h.&lt;br /&gt;
&lt;br /&gt;
* src/io/sys.h: Various functions that assume filenames are in UTF8. Most functions in this file should be removed.&lt;/div&gt;</summary>
		<author><name>Tavmjong</name></author>
	</entry>
</feed>