By MathSmath


2012-06-06 19:25:22 8 Comments

Here's the problem: I paste the HTML entity code for, let's say, a service mark (℠) into the HTML view of the editor. As soon as I switch to the "visual" tab, my entity code is turned into an actual service mark character (I guess the corresponding UTF-8 character or something? I don't know from character encodings...). I don't want this--I want it to stay as the entity reference.

Is there some kind of configuration I can change to stop TinyMCE from doing this? My understanding from reading the internets is that this is not the default behavior--that TinyMCE should actually be doing the opposite, and converting characters to their entities. So is this something specific to WordPress' version of TinyMCE?

2 comments

@MathSmath 2012-06-07 15:14:36

Thanks, fdsa!

For posterity, here's the actual code I used. It adds copyright, registered, trademark, service mark and euro to the array of allowed entities. I'm confused as to why some of these aren't in there by default, as they're really common. But in any case, this works:

// Custom configuration for TinyMCE
function wpsx_54398_configure_tiny_mce( $initArray ) {

    // Add some common entities to the default array (copy, reg, trade, service mark, euro)
    // The odd entires are the entity *number*, the even entries are the entity *name*. If the entity has no name,
    // use the number, prefixed with a hash (for example, the service mark is "8480,#8480").
    $initArray['entities'] = $initArray['entities'] . ',169,copy,174,reg,8482,trade,8480,#8480,8364,euro';

    return $initArray;

}
add_filter('tiny_mce_before_init', 'wpsx_54398_configure_tiny_mce');

@fdsa 2012-06-07 04:12:57

According to this page, you can use the tiny_mce_before_init filter, make sure the entity encoding is set to named, and then add whichever special characters you want to the entities array.

Related Questions

Sponsored Content

1 Answered Questions

TinyMCE HTML Encode Backslash

  • 2014-10-22 15:46:43
  • workabyte
  • 576 View
  • 0 Score
  • 1 Answer
  • Tags:   tinymce encoding

1 Answered Questions

1 Answered Questions

Stop TinyMCE from deleting empty HTML tags

  • 2017-06-30 10:01:04
  • user1589375
  • 654 View
  • 1 Score
  • 1 Answer
  • Tags:   tinymce

3 Answered Questions

[SOLVED] Switch between Visual and HTML tab freely

3 Answered Questions

Sponsored Content