-
Notifications
You must be signed in to change notification settings - Fork 28
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
Unicode character breaks shortcode replacement #25
Comments
@michaloo Thanks for the report. I identified the problem, it will be resolved shortly. |
I've changed and it solved this specific case. I didn't tested other cases. |
I've just tested it and it works as expected, it solves the problem. Big thanks for fast reaction. Dzięki :) |
@michaloo No problem, I wonder why anyone using this library didn't spot that earlier. :) Probably none of them inserted anything multibyte in the shortcode tags. Many thanks for reporting the issue and making this library better. I just released Jeśli masz jakieś inne pomysły na ulepszenie tej biblioteki to daj znać, chętnie o nich porozmawiam. BTW Może będziesz na tegorocznym PHPConie? :) |
I don't have a big experience in working with multibyte strings, but when I started to add more shortcodes/tags I got similar, buggy results. When I run phpunit all tests passed, so library worked correctly, but I couldn't make it working in the application (Apache, Code Igniter, MySQL). I switched to plain I'm using same php configuration to run application and phpunit test suite. I will test it further to diagnose exact source of issue in our application and I will let you know what I found. W tym momencie Shortcode zaspokaja wszystkie nasze potrzeby, wdrażam je do posiadanych przez nas CMSów, żeby umożliwić stylowanie i budowanie struktury treści (jak w WP), z czasem pewnie będziemy mocniej ją wykorzystywać i może coś się nam nasunie :) W każdym razie bardzo chętnie będę w kontakcie. |
@michaloo Looking at the diff of changes in your fork I see that you removed my fix (that line with Cieszę się, że mój kod się Wam przydaje. Tak jak napisałem wyżej, sprawdź kodowanie znaków, bo być może to jest problem. Jeśli nie uda się inaczej to możemy się umówić na jakiegoś Skype'a i spróbować to razem rozwiązać. Tak, jestem aktualnie na PHPConie. :) Update I tested your test case with forcefully converted string to ISO-8859-2 and with minor changes (regex without |
As outlined in the original PR comment: #26 (comment), I was testing the I tracked down the issue to a stray UTF-8 character that was pasted into the content at some point. I never noticed this as it was rendering fine in editor and browser with PHP 5.6 and 7.0, but under PHP 5.5 where UTF-8 is not the standard encoding, I noticed it displayed strangely. I have put together a simple test scenario (https://github.com/rhukster/shortcode-test) that shows this issue. If you switch the parser between
|
@rhukster I managed to track down the bug, you can see the diff 69b2600...5490308 :
I'm tempted to consider this issue resolved as the build is green and I verified results with Also @michaloo, could you please test your inputs once again? |
I will test your fix today also. I guess on the Wordpress parser it depends on what you intend for that parser? Obviously people with WordPress are going to use the parser in WordPress. You can't just take a WordPress shortcode plugin and just run it on some other platform simply because the shortcode is handled the same. All the events and functions are different. My personal opinion is that it enables people to 'port' their WordPress plugins to other platforms, but frankly i'm trying to get away from all the bugs and crappy code in WordPress, so i don't want it's bugs to follow me! Please fix the Wordpress parser too because I want to maintain WordPress syntax in my plugins (to attract WordPress devs and users to Grav CMS), but I don't want it to be buggy. |
@rhukster Have you tested the fix on As for the |
WordPress and Regex parsers are now working as expected for me! Thanks! |
Thanks for your response - as for the fix for |
I've tested |
Hey,
I'm testing following assertion based on README example:
it works fine unless I put some unicode characters inside shortcode.
In case of polish character
ń
it returns'x {"name":"sample","parameters":{"arg":"val"},"content":"\u0144","bbCode":null}] y'
(notice closing]
).In case of 4 polish characters
żółć
it returns'x {"name":"sample","parameters":{"arg":"val"},"content":"\u017c\u00f3\u0142\u0107","bbCode":null}ple] y'
(noticeple]
after shortcode replacement).I'm using
PHP Version 5.5.9-1ubuntu4.11
with Multibyte Support enabled.The text was updated successfully, but these errors were encountered: