[wp-hackers] single quote in content ends up as Unicode Character 'RIGHT SINGLE QUOTATION MARK'
Haluk Karamete
halukkaramete at gmail.com
Tue May 27 11:39:42 UTC 2014
Otto,
I've found a solution to the issue. ( I tested and saw it works )
I simply switched point of views: Instead of protecting the structured data
within the <code></code> area ( which is problematic as my prev message
pointed out) and make that section immune to the wptexturize, I went the
other way. I made the entire shortcode to be exempt from the wptexturize
and mark the content-content section using a non-HTML delim (that the
visual tab editor cannot do anything about ) and apply the wptexturize
myself in the back end.
The simple steps are as follows;
step 1
use the no_texturize_shortcodes filter and made the shortcode to be exempt.
step 2
simply wrap the content area in my shortcode that I want to be processed by
wptexturize in {content}{content} delims.
step 3
in the back end, when processing the $content in my shortcode function,
simply do
$content = wptexturize($content);
- to apply the wptexturize magic over that section
This gives me piece of mind that the section that is not wrapped in
{content}{content} blocks are not processed by the wptexturize - thanks to
the step 1.
This approach has solved my problem.
Now I will see what I can do to do for the little brother of wptexturize
which is wpautop. :)
On Tue, May 27, 2014 at 3:55 AM, Haluk Karamete <halukkaramete at gmail.com>wrote:
> Otto,
>
> The wp_texturize has a great functionality; If you use the HTML tag <code>
> & </code> in your shortcode content area, it leaves that section untouched.
> This way you can create sections within your shortcode as to which area
> wp_texturize to operate on or off.
>
> So for all the special symbols used within the <code> & </code> block,
> (such as the single quote <code>'</code>), I get them as is. For example,
> for the ', I get it as '. I do not get the ’ anymore. The <code>
> feature simply takes care of the problem - in a brilliant way.
>
> But...
>
> If when you switch the post editor's Tiny MCI's visual tab, that simple &
> innocent action ( which is irreversible ) removes the <code> and </code>
> tags permanently and replaces them with ! Then all bets are off.
>
> Is it possible to prevent that from happening so that the structured data
> area that I'm trying to protect thru the <code></code> in my shortcode is
> immune to those innocent and accidental switches that may happen anytime on
> the user's end?
>
> I thought of tapping into the no_texturize_shortcodes filter - as expained
> here (
> http://codex.wordpress.org/Plugin_API/Filter_Reference/no_texturize_shortcodes), as a different way to tackle the whole thing...
>
> But I sense that that would assume the entire content area of the to be
> avoided by the wp_texturize.
>
> My shortcode has two sections... the regular content area section... and
> the code section that has the code instructions .. I'd like to be able to
> separate these two sections ( code and content ) from one another.
>
> In other words, I'd like wp_texturize to do what's designed for on the
> "content-content" area in my shortcode but leave the "content-code" section
> alone..
>
> If the <code></code> were to be preserved upon the visual-tab switch, I
> would be done with this issue and programming the parser now. But I cannot
> move on at this moment before I nail this issue in a future proof way.
>
> What do you think can be done to pull this wish off?
>
>
>
> On Mon, May 26, 2014 at 6:15 PM, Otto <otto at ottodestruct.com> wrote:
>
>> That would be the wptexturize function.
>>
>> http://codex.wordpress.org/Function_Reference/wptexturize
>>
>> -Otto
>>
>>
>> On Mon, May 26, 2014 at 7:31 PM, Haluk Karamete <halukkaramete at gmail.com
>> >wrote:
>>
>> > This is a trickty one...
>> >
>> > When I type in ' ( which is a simple single quote) in the content area
>> in
>> > my shortcode, I see that it ends up as a 'right single quotation mark'
>> that
>> > is ’
>> >
>> > That's observation #1.
>> >
>> > It gets even more interesting, but when I put two of them, one after the
>> > other like this, ( '' ) , I ended up with ” ( instead of
>> > ’’).
>> >
>> > This is very confusing to me cause I'm middle of parsing my structured
>> data
>> > based shortcode. The content area interferes with me big time.
>> >
>> > Could you tell me which WordPress function(s) involve here so that a
>> > simple good old (') single quote ends up with ’? Could you point
>> me
>> > the location where this is happening?
>> >
>> > With that location, I'm hoping to see the complete view of what other
>> > conversion are happening that my parser be aware of.
>> >
>> > Thank you
>> > _______________________________________________
>> > wp-hackers mailing list
>> > wp-hackers at lists.automattic.com
>> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>> >
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
More information about the wp-hackers
mailing list