Conversation
- Text\UniDecoder\UniDecoder is now a "static" class, with static ::decode() method - UniDecoder::decode() now accepts second parameter which is a placeholder for broken or unknown characters. - UniDecoder::decode() now checks if it is provided with a scalar value and will throw an exception otherwise. - UniDecoder now handles broken utf-8 strings and will attempt to repair them. - Add tests for all UniDecoder functionality.
This has been discussed before. It's an utility component which will be used by |
I've noticed that PREG behavior changed between PHP 5.4.4 (I've tested the component against) and PHP 5.4.5 (which is used by travis). This makes one of the tests to fail. I will investigate tomorrow and work around it or modify test to match - transliterating broken utf8 strings is a secondary goal. |
I tagged this as 2.1 because any new feature will be released in that version |
@Thinkscape It looks similar to my work on Zend\Stdlib\StringUtils : https://github.com/marc-mabe/zf2/blob/string/library/Zend/Stdlib/StringUtils.php |
@Maks3w no. I've discussed it before with @DASPRiD and @weierophinney. It's not a feature, it's a utility class. Please read description above. I need it for console to work properly and console is a 2.0 feature. |
@marc-mabe Not really :-) Notice that it does not require or depend on any php extension, instead it shuffles bytes and depends on translit tables. |
@Thinkscape: Sry, can't look into the code currently but doesn't ext/iconv help to transliterate special characters? |
|
@Thinkscape: Only one note: |
Hi, We have renamed the folder for tests from Zend to ZendTest. Can you rebase your PR to catch this change? Thanks in advance. |
- orthographic mistakes fixed - hyphens added
…lly populate the required attribute for the input
…for example, forms become an array of elements.
- A few test assets had snuck into the tree since this PR was added; moved those under the ZendTest directory - phpunit.xml.dist needed to point to ZendTest directory - likewise with run-tests.sh - Also, if you have run a composer install, you still need access to TestAsset files under ZendTest -- as such, I've made autoloading of that namespace happen in all situations, and register the Zend namespace only if the composer autoloader is not present.
- Done for internal consistency; we recommend using "onEventName" for methods that are event listeners.
- Wildcard route was making the assumption that getPath() could return an empty string. Added a logic path to reset $path to '' when a single slash value is discovered.
Note: If your tests are failing after this patch probably you need to do "php composer.phat update" to update Composer's autoloader with the new lists of namespaces
- Modified tests that omitted "/" path from generated URIs to use them.
- Noted change to use verify_peer by default
- Moved to a listener, and made to update the attributes array only if it is boolean true
- null values passed to elements marked as not required should validate
- trailing whitespace
- Test for null before testing is_string/strlen
@Maks3w I've rebased and moved test case to I've installed php 5.4.5 but this single preg tests that failed before seems like a heisenbug. |
You have a problem with the git history. Use |
What's the status of this PR? @Thinkscape do you want me to look into the preg issue? |
@DASPRiD Yeah, fire away. Works for me. |
I really, really want to merge this. However, I've spent about 45 minutes trying to resolve merge commits, and it keeps looking like I'm on the verge of breaking something. If you want to see this in 2.1, can I ask you to please rebase? |
I cherry picked the relevant commits (please review that!) of this PR and applied them on top of a new branch. This should make it easier to merge. The new PR is #2399 |
Just make sure to include the commit with my unit tests. On Fri, Sep 21, 2012 at 2:31 PM, Jurian Sluiman notifications@github.comwrote:
|
Closing this PR, as @juriansluiman made a new one. |
WARNING!!!
When opening FILES CHANGED tab on GitHub it takes a longer while to display an can hang your browser**
Rationale
This PR adds
Zend\Text\UniDecoder
to zf2. It is independent, has no requirements and is an utility class.UniDecoder is used to convert utf-8 strings into plain-ASCII equivalents, transliterating accents and special characters into their ASCII equivalents. The component is loosely-based on Python Unidecoder and the transliteration is based on a database in form of conversion tables.
I want UniDecoder to find it's way into ZF 2.0.0 because I need it for Console transliteration in case the console is non-utf8 compatible and the Application tries to output multibyte strings. Without transliteration, the whole output will become unreadable and certain special characters can modify remote session settings, clear the screen or throw cursor around the screen.
Basic usage
The class is a static class, similar to
Text\Multibyte
and offers a single::decode()
method. Below is an example usage: