Fix UTF support for hashtags

Changelog-Fixed: Fix UTF support for hashtags
Closes: https://github.com/damus-io/damus/issues/1411
Signed-off-by: Daniel D‘Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
Daniel D‘Aquino
2023-08-03 03:38:56 +00:00
committed by William Casarin
parent ef5a3030a6
commit cdc4a7b7a4

View File

@@ -42,7 +42,7 @@ let custom_hashtags: [String: CustomHashtag] = [
func hashtag_str(_ htag: String) -> CompatibleText {
var attributedString = AttributedString(stringLiteral: "#\(htag)")
attributedString.link = URL(string: "damus:t:\(htag)")
attributedString.link = URL(string: "damus:t:\(htag.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? htag)")
let lowertag = htag.lowercased()