Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaped special chars in Android have incorrect rendering #187

Open
yhatt opened this issue Jul 31, 2020 · 1 comment
Open

Escaped special chars in Android have incorrect rendering #187

yhatt opened this issue Jul 31, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@yhatt
Copy link
Owner

yhatt commented Jul 31, 2020

I've found that escaping special character through the fallback text of date formatting is not work correctly in Slack client for Android.

<Blocks>
  <Section>&gt; *bold* _italic_ ~strikethrough~ `code`</Section>
  <Section>
    <Escape>&gt; *bold* _italic_ ~strikethrough~ `code`</Escape>
  </Section>
</Blocks>
[
  {
    "type": "section",
    "text": {
      "type": "mrkdwn",
      "text": "&gt; *bold* _italic_ ~strikethrough~ `code`",
      "verbatim": true
    }
  },
  {
    "type": "section",
    "text": {
      "type": "mrkdwn",
      "text": "­&gt; <!date^00000000^{_}|*>bold<!date^00000000^{_}|*> <!date^00000000^{_}|_>italic<!date^00000000^{_}|_> <!date^00000000^{_}|~>strikethrough<!date^00000000^{_}|~> <!date^00000000^{_}|`>code<!date^00000000^{_}|`>",
      "verbatim": true
    }
  }
]

PC / Web

スクリーンショット 2020-08-01 3 33 26

iOS

Android

Android does not fallback into escaped character and always renders an invalid date format {_}.

We don't want to escape characters by implicit Unicode injection because a copied message would include magic characters that hard to notice by user. (#124) However, I think there is no other way.

@yhatt yhatt added the bug Something isn't working label Jul 31, 2020
@yhatt
Copy link
Owner Author

yhatt commented Jul 31, 2020

I think Combining Grapheme Joiner (&#847;) is the best for escape.
It has a edge case to break expected styling: #190 (comment)

<Blocks>
  <Section>
    <p>_*test*_</p>
    <p>&#847;_&#847;*test&#847;*&#847;_</p>
    <p>`test`</p>
    <p>&#847;`test&#847;`</p>
    <p>_*test*_</p>
    <p>&#847;_&#847;*test&#847;*&#847;_</p>
    <p>`test`</p>
    <p>&#847;`test&#847;`</p>
  </Section>
</Blocks>

The rendering in Slack Block Kit Builder is here. Most of characters are seems to be escaped correctly excepted full-width asterisk ().

Soft hyphen (&shy;) also can use to escape, but it may render unnecessary hyphen if it was brought hyphenation.

<Blocks>
  <Section> <p>&shy;_&shy;*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&shy;*&shy;_</p>
  </Section>
</Blocks>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant