{"id":4900,"date":"2015-09-13T13:37:27","date_gmt":"2015-09-13T10:37:27","guid":{"rendered":"http:\/\/mummila.net\/kommentit\/?p=4900"},"modified":"2015-09-13T13:37:27","modified_gmt":"2015-09-13T10:37:27","slug":"utf-8-support-in-bookmark-names","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2015\/09\/13\/utf-8-support-in-bookmark-names\/","title":{"rendered":"UTF-8 support in bookmark names"},"content":{"rendered":"<p>I&#8217;m in a UTF-8 environment and a lot of my directories&#8217; names have characters above ASCII in them. For many of those it&#8217;d be natural to assign bookmark names that also have characters beyond ASCII. For example, my &#8221;Desktop&#8221; directory is localized as ~\/Ty\u00f6p\u00f6yt\u00e4, and I&#8217;d like to name that bookmark &#8221;ty\u00f6p\u00f6yt\u00e4&#8221;.<\/p>\n<pre><code>jani@saegusa:Ty\u00f6p\u00f6yt\u00e4$ s ty\u00f6p\u00f6yt\u00e4\r\nbookmark name is not valid\r\n<\/code><\/pre>\n<p>This fails because bashmarks validates names using the regexp <code>\/[^A-Za-z0-9_]\/<\/code>. It&#8217;s simple enough to patch to account for the 6 additional characters in my Scandinavian locale, but bashmarks also derives an environment variable name from the bookmark name, and apparently Bash does not support UTF-8 for those:<\/p>\n<pre><code>jani@saegusa:~$ LC_MESSAGES=C export DIR_ty\u00f6p\u00f6yt\u00e4=$HOME\/Ty\u00f6p\u00f6yt\u00e4\/\r\nbash: export: `DIR_ty\u00f6p\u00f6yt\u00e4=\/home\/jani\/Ty\u00f6p\u00f6yt\u00e4\/': not a valid identifier<\/code><\/pre>\n<p>There may be other obstacles as well, those are just the two I could find at a glance.<\/p>\n<p>Obviously I can work around this by not using UTF-8 in bookmark names, but it needlessly increases the mental effort required to recall the names and also the chances of name collisions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For example, my &#8221;Desktop&#8221; directory is localized as ~\/Ty\u00f6p\u00f6yt\u00e4, and I&#8217;d like to name that bookmark &#8221;ty\u00f6p\u00f6yt\u00e4&#8221;.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8860],"tags":[9864],"class_list":["post-4900","post","type-post","status-publish","format-standard","hentry","category-vianhallintajarjestelmat","tag-bash","sijainti-github"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/4900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=4900"}],"version-history":[{"count":3,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/4900\/revisions"}],"predecessor-version":[{"id":4903,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/4900\/revisions\/4903"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=4900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=4900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=4900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}