Welcome Guest, Not a member yet? Register   Sign In
Special characters and their output (utf-8)
#1
Question 

I struggle with the problem that special characters (Ö, Ü, Ä, ß) are not output correctly. I have check these points:

- <meta charset="utf-8">
- $config['charset'] = 'UTF-8';
- database: utf8_unicode_ci


I have already written a function, that works even with normal output:

PHP Code:
function utf8_ausgabe ($str) {
    
    return 
mb_convert_encoding($str'HTML-ENTITIES''utf-8');


[Image: cn1.jpg]

... but in form inputs, it doesn't work. Of course, as well as the '&' is converted.

without convert function:
[Image: cn2.jpg]
with convert function:
[Image: cn3.jpg]

Do you have a solution for this?

Thanks in advance Blush
Reply
#2

(This post was last modified: 03-15-2018, 09:38 AM by InsiteFX.)

HTML 5

PHP Code:
<form action="/action_page.php" accept-charset="ISO-8859-1">

</
form

See the accept charset in the form opening line

Try that and see if it works.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(03-15-2018, 09:37 AM)InsiteFX Wrote: HTML 5

PHP Code:
<form action="/action_page.php" accept-charset="ISO-8859-1">

</
form

See the accept charset in the form opening line

Try that and see if it works.

Thanks, but unfortunately that did not bring a solution Sad
Reply
#4

Your PHP files Controller, Model and View needs to be UTF-8. Your files are in ANSI in the moment. I don't know what texteditor you are using but simple Google "[name] ANSI to UTF-8 Without BOM"
Reply
#5

(03-16-2018, 02:43 AM)jreklund Wrote: Your PHP files Controller, Model and View needs to be UTF-8. Your files are in ANSI in the moment. I don't know what texteditor you are using but simple Google "[name] ANSI to UTF-8 Without BOM"

Thank you, that was probably the solution. I had already checked all relevant files. But one controller file was still with incorrect encoding.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB