HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Scandinavian letters not working

Hi!
I set up Van2Shout 1.051 in my Vanilla Forum version 2.1b1 and it works fine, until someone tries to type in Scandinavian letters. If the message contains even one Scandinavian letter, then the message will be displayed as empty. The post's content in my.domain/forum/index.php?p=/plugin/Van2ShoutData&postcount=50 is empty. Is this a bug that could be repaired easily? If not, is it possible that it would be fixed in future updates?

Other small question is about the update interval: what scale is it? Does the 5000 mean 5000 ms, meaning that it would update itself every 5 sec?

Comments

  • hgtonighthgtonight ∞ · New Moderator
    edited May 2013

    This plugin filters out any characters that aren't in the ISO-8859-1 charset in Van2Shout/controllers/class.van2shoutdata.php line 96.

    //Filter XSS and MySQL injections
    $string = htmlspecialchars($string, null, 'ISO-8859-1');
    

    Changing the charset to UTF-8 may be sufficient. You could also pass the ENT_SUBSTITUTE flag. You can see all options in the full documentation on htmlspecialchars().

    I, personally, would try changing the charset used first:

    //Filter XSS and MySQL injections
    $string = htmlspecialchars($string, null, 'UTF-8');
    

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • KroopeKroope New
    edited May 2013

    That helped a little: I set the ENT_SUBSTITUTE flag and charset to UTF-8 (though at first, the line was only following:

    $string = htmlspecialchars($string)

    I added ... ", ENT_SUBSTITUTE, 'UTF-8'"... and now it sends the message, but all 'ä's and 'ö's are some odd marks instead.

    I noticed that in lines 18 to 19 of the same file, it says the following:

    //Override vanilla's default encoding UTF-8, with UTF-8 e.g. eblah² doesnt work (the ²)

    >

    //header('Content-Type: text/html; charset=ISO-8859-15');

    I'm not quite certain what that eblah2 means?
    Anyways, I commented the line out, copied it and changed the ending to "... charset=UTF-8'" but it didn't help either (it changed the marks from that odd symbol to question marks)

    edit: to be clear: the odd mark and the question marks are those replacement characters that ENT_SUBSITUTE adds :)

  • hgtonighthgtonight ∞ · New Moderator

    The eblah2 is just sample text.

    Just removing the header line work?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Nope, it didn't help. I tried commenting out the header lines, and having the filter line so, that it was only the original ($string), and then the one you suggested, and the one where instead of null I had ENT_SUBSTITUTE flag set.

    If ENT_SUBSTITUTE flag is not set, then the message will be shown as empty, and it is set, then it will show the replacement characters instead of correct letters.

    Could there be some other filtering function somewhere, or could charset be set in some other place?

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭
    edited May 2013

    As a reference https://github.com/Caerostris/Van2Shout/commit/3abcdae91a32eab15469e4733337856b027f9093

    What version of the plugin are you using, from the "addons" directory or from the github repo?

    There was an error rendering this rich post.

  • KroopeKroope New
    edited May 2013

    I'm using the version from the "addons" directory (version 1.051).

    I made the changes describedd in github link, so now my file looks like it, but it didn't really help.

    edit:
    actually something changed: now everything I type, regardless whether it has Scandinavian letters or not, it won't show.

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    Probably @caerostris can give you more information.

    There was an error rendering this rich post.

  • I've tried to reproduce the bug you described using the the latest version of Van2Shout from github (including the patch lifeisfoo posted earlier) and both the firebase and the MySQL backend work flawlessly, I've tried the following characters: ø, Æ, æ, å. Are those characters the ones you are having trouble with?
    Please try the following: Delete your current installation of Van2Shout (/plugins/Van2Shout), download the latest version from github here: https://github.com/Caerostris/Van2Shout/archive/master.zip , unzip it and reupload the new one. This should be practically the same as manually incorporating the patch lifeisfoo posted, but this works for me...

    As to your question regarding the update interval: Yup, it's ms so 5000 means 5 seconds. What the shoutbox does is downloading a new list of messages every 5 seconds. The shoutbox will be much faster than that if you use firebase! It might be that firebase will cost some 4$ a month pretty soon but while they're still in beta, the service is free of charge.

  • KroopeKroope New
    edited May 2013

    The github version works very well, now all the letters show correctly (I use å ä and ö)! Thanks for the help!

    Only thing that is not working correct is the settings page: if I try to access the Van2Shout settings view, it says: "Whoops! View not found."

    And when I downloaded the github version, I unziped it, it made a folder called "Van2Shout-master", and it caused the forum not to show anything: the right panel showed, but the discussions, settings and the other stuff on the left panel didn't show. That was corrected by changing the folder's name to "Van2Shout".

    edit: By the way, why is the version different in github and in the addons directory?

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    Plugin's directory name should be "Van2Shout"[1]. When downloading a plugin from github always remove the "-master".

    [1] This is a problem, common to many plugins, since they use hardcoded directory name inside .php files. Note that the addons directory requires a consistent directory's name (dirname == plugin name, see class.myplugin.php for the name).

    There was an error rendering this rich post.

  • caerostriscaerostris ✭✭
    edited May 2013

    The issue with the settings view is strange, I'll try to set up a new forum for myself and see what happens!
    It's not actually a bug that Github names the folder Van2Shout-master, but you did the right thing when you renamed it to Van2Shout ;-)

    Github is a platform we use to develop Van2Shout. Lot of the code was developed by me, but lifeisfoo and izifortune helped fixing a couple of bugs and Github helps us keeping track of who added which patch and so on...
    So what you find there is the latest version we are still working on. Right know there's just a couple of minor things that changed, like the fixed scandinavian-letter bug, some localisation improvements and some changes to the firebase backend and I don't think that's enough to upload a new version here at vf.org...

    See here: This is a log of all changes we've done to Van2Shout since we uploaded it to github: https://github.com/Caerostris/Van2Shout/commits/master

  • Ok that clarifies it :) Thank you very much for your help!

Sign In or Register to comment.