-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
triggers "hidden Unicode characters" warning
#18324
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
Comments
|
this is not the same as this. nor is ä the same as ä! |
Yep, unicode is very tricky. The question is what should we do or should we be too strict?
|
I tried to just warn for bad bidi and was forced to add warning for every use of bidi. At that point I simply added escaping for every non-visible character. Genuine homoglyph detection stalled because the original PR completely stalled. The code has the ability to mark the escape with the type of character that is escaping. We can tune where and when the warning occurs instead of just for any escaping. Adding in a classifier to the type of escaping would also be easy and so would then be escaping only for certain types of characters etc. |
Isn't it sufficient to only highlight the bidi characters? What's the purpose of the "invisible characters" warning? I mean any space-type character is "invisible" by definition and not really a concern, or is it? |
|
incorrectly triggers "hidden Unicode characters" warning
triggers "hidden Unicode characters" warning
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index d8398f6d9..036a1a983 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1015,6 +1015,9 @@ bidi_bad_description_escaped = `This file contains unexpected Bidirectional Unic
unicode_header = `This file contains hidden Unicode characters!`
unicode_description = `This file contains hidden Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.`
unicode_description_escaped = `This file contains hidden Unicode characters. Hidden unicode characters are escaped below. Use the Unescape button to show how they render.`
+bidi_header = `This file contains Bidirectional Unicode characters!`
+bidi_description = `This file contains Bidirectional Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.`
+bidi_description_escaped = `This file contains Bidirectional Unicode characters. Hidden unicode characters are escaped below. Use the Unescape button to show how they render.`
line_unicode = `This line has hidden unicode characters`
escape_control_characters = Escape
diff --git a/templates/repo/unicode_escape_prompt.tmpl b/templates/repo/unicode_escape_prompt.tmpl
index 855d7866a..171752498 100644
--- a/templates/repo/unicode_escape_prompt.tmpl
+++ b/templates/repo/unicode_escape_prompt.tmpl
@@ -7,13 +7,13 @@
</div>
<p>{{$.root.i18n.Tr "repo.bidi_bad_description" | Str2html}}</p>
</div>
- {{else if .EscapeStatus.Escaped}}
+ {{else if .EscapeStatus.HasBIDI}}
<div class="ui warning message unicode-escape-prompt">
<span class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</span>
<div class="header">
- {{$.root.i18n.Tr "repo.unicode_header"}}
+ {{$.root.i18n.Tr "repo.bidi_header"}}
</div>
- <p>{{$.root.i18n.Tr "repo.unicode_description" | Str2html}}</p>
+ <p>{{$.root.i18n.Tr "repo.bidi_description" | Str2html}}</p>
</div>
{{end}}
{{end}}
Would simply drop the header and only show it if there are bidi characters. The |
Yes, non-ASCII spaces could still be highlighted, they are usually an error in code. But I'd certainly get rid of the obnoxious yellow box unless there are BIDI characters.
|
Without the "obnoxious" box there is nothing shown in rendered markdown except that the "escape" button is present. |
Fix go-gitea#18324 Signed-off-by: Andrew Thornton <[email protected]>
Fix #18324 Signed-off-by: Andrew Thornton <[email protected]>
Fix go-gitea#18324 Signed-off-by: Andrew Thornton <[email protected]>
Description
https://try.gitea.io/silverwind/symlink-test/src/branch/master/bidi.md
https://github.com/silverwind/symlink-test/blob/master/bidi.md
The file contains
a b
and triggers the "hidden Unicode characters" warning on Gitea while it doesn't on GitHub. I think this character may need to be excluded from the warning as it's pretty commonly used in Markdown for non-nefarious purposes.The text was updated successfully, but these errors were encountered: