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
accept "%c" placeholder for channel icons to use unmangled channel #582
Conversation
|
@perexg I added proper (hopefully) URL encoding |
| The following placeholders are available:<br> | ||
| <ul> | ||
| <li>%C - the channel name with safe characters (no spaces etc.)</li> | ||
| <li>%c - the channel name (untouched)</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention utf8 encoding here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about it?
|
@perexg is this what you meant? |
|
I meant to explicitly tell the user that the encoded string is using the utf8 encoding (which internally tvheadend uses for all international/language strings). |
|
and while it's being debated, I'm not sure that mangled/unmangled carries the right meaning. 'Translated' or 'converted' would be better. |
|
@perexg in that case I read the code wrong, are you saying the resulting string is in UTF-8? @ProfYaffle sure, there may be a better word. I believe "transliterated" is the correct one, but no one understands what that means. |
|
Well, 'transliteration' would certainly do, and makes sense to me - but yes, it'd probably be lost on most people... nearly as many as 'unmangled' would perhaps be. And I'm not sure UTF-8 is the issue here, as space == ASCII 32 == UTF-8 0x20. I think the UTF-8 bit as it applies to non-ASCII characters (e.g. ö, ŵ) is necessary, but this is also about translating reserved or 'unsafe' characters, as per the URI specifications: http://www.ietf.org/rfc/rfc1738.txt Just trying to help, though, it's your call. |
|
The chname string is utf8 string. You only encode it in %c condition (for HTTP URL), right ? I meant only to tell the user in the help, that this URL encoded channel name willl use utf8 for international characters, because it's not obvious. |
|
@ProfYaffle updated the help text a bit, mind taking a look? |
| else if((send = strstr(chi, "%c"))) { | ||
| char *aname = intlconv_utf8safestr(intlconv_charset_id("ASCII", 1, 1), | ||
| chname, strlen(chname) * 2); | ||
| sname = url_encode(aname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing NULL check for aname. The NULL can be returned if iconv() function fails for a reason.
|
Go for it - we can always alter it later if folks really don't understand/disagree (e.g. 'no spaces' <> 'ASCII' for obvious reasons). But it's fine. |
c1c1a36
to
bceb3f0
Compare
|
@perexg added the NULL check and squashed, should be good to go. |
|
Merged. Thanks. |
I have all my channel icons on a web server named exactly like the channel, e.g. "Yle TV1 HD.png". With this patch I don't have to do any renaming when mapping channels.
@perexg does tvheadend have a helper for URL-encoding strings? I'm not completely sure that the current approach works since the URL isn't escaped (spaces should be converted to %20 etc.).