emanote icon indicating copy to clipboard operation
emanote copied to clipboard

Stork search unicode issue in title

Open srid opened this issue 2 years ago • 2 comments

From @jilleJr https://github.com/EmaApps/emanote/pull/327#issuecomment-1214423019

Emojis are broken in the search results. The \U000... part.

image

@srid I found the cause. I made Emanote write the TOML file it pipes to stork to a file, and in it we find:

[[input.files]]
  path = "./docs/demo/markdown.md"
  title = "Extended Markdown \\U0000270d\\U0000fe0f"
  url = "demo/markdown.html"

It's escaping the unicode-syntax. It should only be 1 backslash there.

image

I.e, it seems to be somewhere in the haskell code that's causing this

Originally posted by @jilleJr in https://github.com/EmaApps/emanote/issues/327#issuecomment-1214423019

srid avatar Aug 17 '22 23:08 srid

Reproducible in bin/repl:

ghci> import qualified Toml
ghci> putTextLn $ Toml.encode (Toml.text "k") "✍️"
k = "\\U0000270d\\U0000fe0f"

ghci> 

Notice that it double-escapes the unicode letters.

Using T.replace "\\\\" "\\" . Toml.encode (not a proper fix), the original bug vanishes - which confirms that the problem is with the double-escaping.

Possibly related: https://github.com/kowainik/tomland/issues/334

srid avatar Aug 17 '22 23:08 srid

Looks to be an upstream bug: https://github.com/kowainik/tomland/issues/408

srid avatar Aug 18 '22 00:08 srid

Closing because of workaround

srid avatar Oct 29 '22 19:10 srid