Welcome Guest, Not a member yet? Register   Sign In
Special caracters
#1

[eluser]yorvik[/eluser]
Hello

I am getting data from a database
where I show it with echo $record->myField;

For example I get this word Lindström Bengt => but this is not the way I want the word to be shown.

Lindström Bengt should be => Linström Brengt
In my table the word is spelled ok. But CI show some strange carracters for ö. How can I fix this.

Thanks in advance!
#3

[eluser]Nick_MyShuitings[/eluser]
You can also do a php function if you get tired of bashing your head against the DB settings... run a utf8_decode on that and it should show up properly...
#4

[eluser]yorvik[/eluser]
I will give the utf8_decode() a try. Thanks for the advice.
Edit: the utf8_decode() fixed it thank you Smile
#5

[eluser]Nick_MyShuitings[/eluser]
np... I learned that after long hours of cursing when a crappy SOAP API I had to consume returned the data all weird like that.
#6

[eluser]yorvik[/eluser]
What I don't understand is that I need to decode utf8 like php manual says:

Quote:This function decodes data, assumed to be UTF-8 encoded, to ISO-8859-1.

If it is decoded my text is spelled correct. Then why do I need this utf8 char_set?
Because I never had a problem like this before if worked without the CI Framework.

It would be a lot of work if I have to utf8_decode() all my output?

thanks
#7

[eluser]Krzemo[/eluser]
Have you had a chance to read http://philsturgeon.co.uk/news/2009/08/U...odeIgniter?
utf8_decode() isn't magic cure for bad design and bad code ...
#8

[eluser]Nick_MyShuitings[/eluser]
[quote author="Cshamoh" date="1294636525"]Have you had a chance to read http://philsturgeon.co.uk/news/2009/08/U...odeIgniter?
utf8_decode() isn't magic cure for bad design and bad code ...[/quote]

100% agreed... but it is a quick patch if you're in a bind. In my example I couldn't control the horrible design of the web-service and had to take what I got. If you control the whole project its really only a few simple steps to get UTF-8 working properly across editor, php, mysql, and then CI.
#9

[eluser]yorvik[/eluser]
Ok I read the article set everything ok I made some errors on my previous project where my data in my database was not converted to UTF8.

Thanks for the help!




Theme © iAndrew 2016 - Forum software by © MyBB