Post with MarsEdit - Bizarre character replacement?
  • Hey! I just bought MarsEdit and haven't been happier with blog software. However, when I use the bookmarklet sometimes things happen where it'll replace certain characters with bizarre codes. Like, for example, a - will be replaced with like, %2014, or quotes will be replaced with something, and so on and so forth.

    Is this a problem with the bookmarklet or the application? Is it avoidable? It's not a horrible problem, but I'd rather not have to look through posts to pull out the codes and replace them with their actual intended characters.
  • Hi monofonik - it sounds like what you're observing is a phenomenon related to the use of encoded "non-ascii" characters in the page title. For some characters that fall outside the basic set, HTML requires that they be replaced with numeric codes. But it looks like this is throwing off MarsEdit's bookmarklet - so I'll definitely look into it.

    To confirm that I understand the bug, here's a test case. Copy/paste the following text into this page's URL field, and hit return. That should cause the page's title to temporarily change to an example title that causes the bug when "Post with MarsEdit" is clicked.

    javascript:document.title="Simple Characters — Separated By an Em Dash, or “Called Out With Smart-Quotes”"

    Sorry for the inconvenience but I will post here again if I find a workaround before the bug is fixed in MarsEdit.

    Thanks for reporting it.

    Daniel
  • Samurai Coder's HQ found the issue a while ago (http://samuraicoder.net/double_byte_characters_and_marsedit_bookmarklet) A related issue is that the URL might have double-byte characters in Safari. (In Firefox, international URLs are not supported, so every URL is converted into entities (or whatever they are called). This also causes the same issue. So, both URL and title have the issue.

    I was looking into this issue because other bookmarklets provided with Yojimbo and WebnoteHappy work without this issue. But, WebnoteHappy used to have this issue.

    It seems that "encodeURIComponent()" is a key. I'm not sure if the application side needs how to accept the URL, title and selected text.
  • Thanks Takaaki! You led me right to the solution. Indeed, using encodeURIComponent is the right thing to do here, and it makes everything (as far as I can tell) "just work!"

    Both of you should try the new bookmarklet I posted on my blog:

    http://www.red-sweater.com/blog/289/an-even-better-bookmarklet

    Let me know how it works! I tested it against both the test title I posted above, and the Japanese wikipedia page Takaaki referenced in his post.

    Daniel
  • I'm not sure if this is okay, but the URL in the anchor tags might need to be converted to the entities. For example,

    http://ja.wikipedia.org/wiki/??????

    is equal to

    http://ja.wikipedia.org/wiki/%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%9A%E3%83%BC%E3%82%B8

    I'm saying this because I'm not sure if all the browsers including Windows browsers allow doulbe-byte characters in the URL.
  • Shit. Even this forum doesn't suport :)

    Question marks above are not mean to be question marks! I'll email the example to Daniel.
  • Haha! Sucks that the forum software didn't support that. For those who are curious, the ??? are double-byte characters.

    I think I see what you mean, Takaaki. At first when you mentioned Windows browsers I thought "who cares?" because nobody will use the bookmarklet from a Windows browser. But I think you mean that if you're blogging about the URL, it needs to be blogged in the fully escaped form - is that right? So that on your blog, Windows users will still be follow the link?

    Daniel
  • Yes, that's what I meant.

    Read between the lines, please. I suck at English. :)

    This post I just made (http://takaakiblog.com/post/100469) has double-byte characters which are not converted. I can tell so as far as I check the source in Safari. I'm not sure if these URLs are handled properly in other browsers.

    I gotta sleep. It's midnight in Japan.
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!