Project

General

Profile

pastebin plugin and Cyrillic letters

Added by Ivan Cenov over 13 years ago

Hi, congratulations about the plugin. It generally works, but I think I found a bug in it.
  1. Paste C code without any Cyrillic letters in it - the paste is successful.
  2. Paste C code with even a single Cyrillic character (in a string or comment) the paste is not successful and you'll receive
    Internal error
    
    An error occurred on the page you were trying to access.
    If you continue to experience problems please contact your redMine administrator for assistance.
    
    Back
    

Replies (5)

RE: pastebin plugin and Cyrillic letters - Added by Ivan Cenov over 13 years ago

Also, several suggestions:
  • add new field in paste database table: "title" and allow a paste to be referred using http://redmine_host/pastes/title
  • implement this wiki-like functionality: where pastebin:"title" occurs to be replaced with a link to the pastebin
  • texts are hardcoded in the code of the plugin. It would be better to put them inside en.yml to allow localization

RE: pastebin plugin and Cyrillic letters - Added by Ivan Cenov over 13 years ago

I think I found where the problem arises from. The 'pastes' table was with default charset 'latin1' instead of 'utf8'. The same with 'text' and 'lang' columns. After I changed their charset to utf-8 and the error disappeared.

I don't know how 'pastes' table got 'latin1' default charset.

RE: pastebin plugin and Cyrillic letters - Added by Alex Shulgin over 13 years ago

Ivan Cenov wrote:

Also, several suggestions:

Thanks for your interest and suggestions, however it's not the best place to reach me. I only accidentally found this forum thread just now. :D

Hm, should be definitely doable, but what if title is a decimal number? Do we find_by_title or find_by_id in this case?

  • implement this wiki-like functionality: where pastebin:"title" occurs to be replaced with a link to the pastebin

This is planned for future, I only need to come up with a good wiki syntax :)

  • texts are hardcoded in the code of the plugin. It would be better to put them inside en.yml to allow localization

Yes, this could be improved. Care to submit a patch?

--
Regards,
Alex

RE: pastebin plugin and Cyrillic letters - Added by Ivan Cenov over 13 years ago

Hm, should be definitely doable, but what if title is a decimal number? Do we find_by_title or find_by_id in this case?

I didn't think about this case. Par example find_by_title will have higher precedence than find_by_id. If this should be overridden, is this possible: http://redmine_host/pastes/id=1234 or http://redmine_host/pastes/t="1234 5678" ?

Yes, this could be improved. Care to submit a patch?

I'm sorry this is impossible for me. I am not Ruby/RoR programmer. I only write classic C programs for embedded systems. This is why I participate in several projects with translation to Bulgarian language only.

Regards,
Ivan

RE: pastebin plugin and Cyrillic letters - Added by Alex Shulgin over 13 years ago

Ivan Cenov wrote:

Hm, should be definitely doable, but what if title is a decimal number? Do we find_by_title or find_by_id in this case?

I didn't think about this case. Par example find_by_title will have higher precedence than find_by_id. If this should be overridden, is this possible: http://redmine_host/pastes/id=1234 or http://redmine_host/pastes/t="1234 5678" ?

Hm, it now appeared to me that find_by_title might well return multiple records (because nothing stops you from having multiple pastes with the same title), so pastes/<title> URL are not possible at all.

Yes, this could be improved. Care to submit a patch?

I'm sorry this is impossible for me. I am not Ruby/RoR programmer. I only write classic C programs for embedded systems. This is why I participate in several projects with translation to Bulgarian language only.

OK, I understand. Thanks again for your suggestions :)

--
Alex

    (1-5/5)