Skip to content
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

Fix the ignore english character function? #4

Closed
vanabel opened this issue Jan 25, 2016 · 5 comments
Closed

Fix the ignore english character function? #4

vanabel opened this issue Jan 25, 2016 · 5 comments

Comments

@vanabel
Copy link

vanabel commented Jan 25, 2016

I do believe that the plugin ignore the character of english is not a good option, which I try to fix it as

# in `so-pinyin-slugs/inc/functions.php`
...
}else {
            //non chinese characters will be ignored
            $strRet .= preg_replace( "/[^A-Za-z0-9\-]/", "$0", chr( $byte1st ) );
        }
...

Where I modify the second parameter of preg_replace from '' to $0, which means we do not change the character if it is alphabetic. I don't know whether this will cause other issue, But it seems work for me!!

@senlin
Copy link
Owner

senlin commented Jan 25, 2016

Hi @vanabel
Thanks for your input.
What you describe is a known issue, documented in the plugin's FAQ.

I have just tested your solution and that indeed seems to work!

Before I commit this, can I ask you how well have you tested it?

Thanks,
Piet

@vanabel
Copy link
Author

vanabel commented Jan 25, 2016

I just test it for my newest article, which seems work for me. Since it seems an easy solution, I suspect there are some unexpected issue.

@senlin
Copy link
Owner

senlin commented Jan 25, 2016

All right.

Will you be using the plugin actively for what you're currently doing?
The reason I ask is because it can be an idea to have a test period of a week or two to see if there are any negative side effects.

For example what does it do to existing slugs? We wouldn't want to start messing up people's permalinks, right ;)

If we can establish no side effects during such a testing period, then I am all for switching out the code with your discovery!

@senlin
Copy link
Owner

senlin commented Jan 25, 2016

Also it would be nice to know how did you get to replace '' with $0?

senlin pushed a commit that referenced this issue Mar 10, 2016
* fix to not ignore alphanumerical characters by
[vanabel](https://github.com/vanabel), closes [issue
#4](#4)
@senlin
Copy link
Owner

senlin commented Mar 10, 2016

Committed and released, thank you very much @vanabel

@senlin senlin closed this as completed Mar 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants