| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | Plugin Name: Latin-2-UTF |
|---|
| 4 | Plugin URI: http://kackreiz.net/wordpress.php |
|---|
| 5 | Description: Since old versions of Wordpress used Latin-1 encoding for all the |
|---|
| 6 | content, displaying these old entries through a new WP Version (using UTF-8) |
|---|
| 7 | looks ugly. This Plugin converts the German Umlauts Ä...ü and ß |
|---|
| 8 | from Latin1 to UTF8. |
|---|
| 9 | |
|---|
| 10 | Version: 1.0 |
|---|
| 11 | Author: Jan Varwig |
|---|
| 12 | Author URI: http://kackreiz.net |
|---|
| 13 | |
|---|
| 14 | INSTALLATION: |
|---|
| 15 | 1. Copy into wp-content/plugins and activate it in the admin-panel. |
|---|
| 16 | 2. You can now use the filter latin2utf on any of your text-snippets |
|---|
| 17 | (like "the_content", "comment_text", etc.)More information on this can be |
|---|
| 18 | found here: |
|---|
| 19 | http://wiki.wordpress.org/Plugin/API |
|---|
| 20 | For example you can put |
|---|
| 21 | add_filter('the_content', 'latin2utf'); |
|---|
| 22 | on top of your index.php, after the |
|---|
| 23 | require('./wp-blog-header.php'); |
|---|
| 24 | line |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | function latin2utf($string){ |
|---|
| 28 | $search = array ('Ä','Ö','Ü','ä','ö','ü','ß'); |
|---|
| 29 | $replace = array ('Ã','Ã','Ã','ä','ö','ü','Ã'); |
|---|
| 30 | $string = str_replace($search,$replace,$string); |
|---|
| 31 | return $string; |
|---|
| 32 | } |
|---|
| 33 | ?> |
|---|