[GH-ISSUE #737] UTF-8 Actions Header #538

Closed
opened 2026-05-07 00:25:14 +02:00 by BreizhHardware · 3 comments

Originally created by @cfouche3005 on GitHub (May 20, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/737

🐞 Describe the bug

Ntfy server seem to block every POST request with an UTF-8 character ( à ) inside the Actions Header (for the label) but when I had an an UTF-8 character inside the Title Header or the body, it is processed normally and give the correct output or an unknow character due to bad UTF-8 processing (not a bug, I think)

💻 Components impacted

Ntfy Server

💡 Screenshots and/or logs

ntfy server log:

2023/05/20 18:02:55 DEBUG Connection closed with HTTP 400 (ntfy error 40018) (error=invalid request: actions invalid; invalid utf-8 string, error_code=40018, http_method=POST, http_path=/Netbird, http_status=400, tag=http, topic=Netbird, topic_last_access=2023-05-20T18:02:44.21Z, topic_subscribers=1, user_id=u_Iyy0BJTPUR, user_name=cfouche, visitor_auth_limiter_limit=0.016666666666666666, visitor_auth_limiter_tokens=30, visitor_emails=0, visitor_emails_limit=24, visitor_emails_remaining=24, visitor_id=ip:REDACTED, visitor_ip=REDACTED, visitor_messages=0, visitor_messages_limit=17280, visitor_messages_remaining=17280, visitor_request_limiter_limit=0.2, visitor_request_limiter_tokens=59.000016648, visitor_seen=2023-05-20T18:02:55.92Z)

image

Actions Header : http, "Mettre à jour", "https://REDACTED/webhook/netbird-update", method=GET, headers.AUTH=REDACTED

🔮 Additional context

I can't use the JSON method because I need the Icon parameter and it isn't supported

Originally created by @cfouche3005 on GitHub (May 20, 2023). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/737 :lady_beetle: **Describe the bug** <!-- A clear and concise description of the problem. --> Ntfy server seem to block every POST request with an UTF-8 character ( à ) inside the Actions Header (for the label) but when I had an an UTF-8 character inside the Title Header or the body, it is processed normally and give the correct output or an unknow character due to bad UTF-8 processing (not a bug, I think) :computer: **Components impacted** <!-- ntfy server, Android app, iOS app, web app --> Ntfy Server :bulb: **Screenshots and/or logs** <!-- If applicable, add screenshots or share logs help explain your problem. To get logs from the ... - ntfy server: Enable "log-level: trace" in your server.yml file - Android app: Go to "Settings" -> "Record logs", then eventually "Copy/upload logs" - web app: Press "F12" and find the "Console" window --> ntfy server log: ``` 2023/05/20 18:02:55 DEBUG Connection closed with HTTP 400 (ntfy error 40018) (error=invalid request: actions invalid; invalid utf-8 string, error_code=40018, http_method=POST, http_path=/Netbird, http_status=400, tag=http, topic=Netbird, topic_last_access=2023-05-20T18:02:44.21Z, topic_subscribers=1, user_id=u_Iyy0BJTPUR, user_name=cfouche, visitor_auth_limiter_limit=0.016666666666666666, visitor_auth_limiter_tokens=30, visitor_emails=0, visitor_emails_limit=24, visitor_emails_remaining=24, visitor_id=ip:REDACTED, visitor_ip=REDACTED, visitor_messages=0, visitor_messages_limit=17280, visitor_messages_remaining=17280, visitor_request_limiter_limit=0.2, visitor_request_limiter_tokens=59.000016648, visitor_seen=2023-05-20T18:02:55.92Z) ``` ![image](https://github.com/binwiederhier/ntfy/assets/51720655/0508f886-5ca6-4700-ba27-cc688cdbf369) Actions Header : `http, "Mettre à jour", "https://REDACTED/webhook/netbird-update", method=GET, headers.AUTH=REDACTED` :crystal_ball: **Additional context** <!-- Add any other context about the problem here. --> I can't use the JSON method because I need the Icon parameter and it isn't supported
BreizhHardware 2026-05-07 00:25:14 +02:00
  • closed this issue
  • added the
    🪲 bug
    label
Author
Owner

@binwiederhier commented on GitHub (May 21, 2023):

UTF-8 headers are supported by the ntfy server, but many clients have trouble with it. So it is likely that your IDE and/or programming language is incorrectly encoding the header. This is because the HTTP spec doesn't officially support UTF-8 header.

It works on Linux with curl:

$ curl -d "hi there" -H 'Actions: http, "Mettre à jour", "https://REDACTED/webhook/netbird-update", method=GET, headers.AUTH=REDACTED' ntfy.sh/test12
{"id":"3CSBNE1cyHEh","time":1684704669,"expires":1684747869,"event":"message","topic":"test12","message":"hi there","actions":[{"id":"4jvCVVB6D4","action":"http","label":"Mettre à jour","clear":false,"url":"https://REDACTED/webhook/netbird-update","method":"GET","headers":{"AUTH":"REDACTED"}}]}

That said, a few of the other headers can already be encoded with RFC 2047 type strings, but the action description cannot. Maybe we should add that support too. Then you could do:

http, "=?utf-8?q?Mettre =C3=A0 jour?=", "https://REDACTED/webhook/netbird-update"

I think that's reasonable.

I can't use the JSON method because I need the Icon parameter and it isn't supported

The icon param should be supported. Here's and example with curl:

$ curl -d '{"topic":"test123","icon":"http://some.icon.org/hi.jpg"}' ntfy.sh
{"id":"WCDj1GfaF6H4","time":1684705371,"expires":1684748571,"event":"message","topic":"test123","message":"triggered","icon":"http://some.icon.org/hi.jpg"}
<!-- gh-comment-id:1556299201 --> @binwiederhier commented on GitHub (May 21, 2023): UTF-8 headers are supported by the ntfy server, but many clients have trouble with it. So it is likely that your IDE and/or programming language is incorrectly encoding the header. This is because the HTTP spec doesn't officially support UTF-8 header. It works on Linux with curl: ``` $ curl -d "hi there" -H 'Actions: http, "Mettre à jour", "https://REDACTED/webhook/netbird-update", method=GET, headers.AUTH=REDACTED' ntfy.sh/test12 {"id":"3CSBNE1cyHEh","time":1684704669,"expires":1684747869,"event":"message","topic":"test12","message":"hi there","actions":[{"id":"4jvCVVB6D4","action":"http","label":"Mettre à jour","clear":false,"url":"https://REDACTED/webhook/netbird-update","method":"GET","headers":{"AUTH":"REDACTED"}}]} ``` That said, a few of the other headers can already be encoded with RFC 2047 type strings, but the action description cannot. Maybe we should add that support too. Then you could do: ``` http, "=?utf-8?q?Mettre =C3=A0 jour?=", "https://REDACTED/webhook/netbird-update" ``` I think that's reasonable. > I can't use the JSON method because I need the Icon parameter and it isn't supported The icon param should be supported. Here's and example with curl: ``` $ curl -d '{"topic":"test123","icon":"http://some.icon.org/hi.jpg"}' ntfy.sh {"id":"WCDj1GfaF6H4","time":1684705371,"expires":1684748571,"event":"message","topic":"test123","message":"triggered","icon":"http://some.icon.org/hi.jpg"} ```
Author
Owner

@cfouche3005 commented on GitHub (May 21, 2023):

That said, a few of the other headers can already be encoded with RFC 2047 type strings, but the action description cannot. Maybe we should add that support too.

Yes, It would be very nice.

The icon param should be supported.

It was not inside the overview of the supported field of the documentation so I thought it was not supported
https://docs.ntfy.sh/publish/#publish-as-json

<!-- gh-comment-id:1556302322 --> @cfouche3005 commented on GitHub (May 21, 2023): > That said, a few of the other headers can already be encoded with RFC 2047 type strings, but the action description cannot. Maybe we should add that support too. Yes, It would be very nice. > The icon param should be supported. It was not inside the overview of the supported field of the documentation so I thought it was not supported https://docs.ntfy.sh/publish/#publish-as-json
Author
Owner

@binwiederhier commented on GitHub (May 22, 2023):

Done in github.com/binwiederhier/ntfy@168ad8bf1b -- Will be in the next release

<!-- gh-comment-id:1556360815 --> @binwiederhier commented on GitHub (May 22, 2023): Done in https://github.com/binwiederhier/ntfy/commit/168ad8bf1b46fc1edc5fb1388e0ce86e2b73c9ef -- Will be in the next release
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#538
No description provided.