Welcome Guest, Not a member yet? Register   Sign In
Character encoding problem
#1

[eluser]terbor[/eluser]
I am having a hard time finding this solution. MySQL stores user submitted articles and when I display the article certain characters are thrown into the <?> when I view it in my browser. I dont know if there is a CI setting somewhere where I can add these characters to .... I am having a hard time finding similar issues regarding character encoding with PHP & MySQL. The article is stored as a BLOB (not sure if that matters)

Thanks
#2

[eluser]überfuzz[/eluser]
What charset are you using? My guess is that you should use utf 8, to get all specials.

First step of solving this could be, look through you system and see what you're using.
#3

[eluser]terbor[/eluser]
Thank you for the reply,

In the config.php

Code:
$config['charset'] = "UTF-8";

In the database.php (in config)

Code:
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

The issue is that the quotes " and ' are looking like the <?> image when printed on the screen. At least those are the only ones I see right now. I am working local with firefox and in the head I have

Code:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

I am not really sure what else could be effecting this...
#4

[eluser]Adrien.[/eluser]
Hi everyone,

I'm having the same kind of trouble, every special character such as french accents is replaced by a <?> character. I'm not retrieving any data from the database, the content of my page is hard coded.

In config.php I have :

Code:
$config['charset'] = "UTF-8";

And in the <head> part of my page I have :

Code:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


Thanks in advance !
#5

[eluser]Adrien.[/eluser]
Hi again,

I've just figured out how to fix the problem. I replaced all the :
Code:
<?php $this->load->view('sample/footer_view') ?>
in my view by :
Code:
<?php echo utf8_encode($this->load->view('sample/footer_view','',TRUE)); ?>

But it's quite ugly... Isn't there a sexier way to do this ?

Thanks in advance.
#6

[eluser]RayDube[/eluser]
Hi There,

You may have found a solution since you posted this a month ago, but I also found one after reading this thread and thought I should place it here, for the next guy like me who happens along here. Smile

Code:
<? header('Content-Type: text/html; Charset=UTF-8');  ?>

If you place that at the top of your view, you should be Okey-dokey!

Ray




Theme © iAndrew 2016 - Forum software by © MyBB