# Update to website not printing special Characters

**URL:** <https://www.ruby-forum.com/t/update-to-website-not-printing-special-characters/195241>\
**Category:** Rails\
**Created:** [September 20, 2010, 12:46pm UTC](https://www.ruby-forum.com/t/update-to-website-not-printing-special-characters/195241 "2010-09-20T12:46:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmcclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dmcclean](https://www.ruby-forum.com/u/dmcclean)\
**Post date:** [September 20, 2010, 12:46pm UTC](https://www.ruby-forum.com/t/update-to-website-not-printing-special-characters/195241/1 "2010-09-20T12:46:51Z")

</div>

I thought you might be interested in how far I have got with solving  
my problem with MySql(via phpMyAdmin) to website character\_set  
problems.

I thought I had solved the problem when my characters on my website  
started showing the special characters.

This was a partial success though.

When I went back to phpMyAdmin and entered new text the problem was  
the same, but reversed. What now happens is that the original text I  
typed is now converted to gibberish(Latin1 to UTF8)

and new text entered, in phpMyAdmin, is output to website as “?”  
again  
See:-

[http://donsgarden.co.uk/pests/228?telephone=2](http://donsgarden.co.uk/pests/228?telephone=2)

What I did, as I could not change the server Craracter\_set and  
Collation (Shared Server). I got my host to change everything back to  
Latin1. I was going to change my w/site meta line to ISO 8859-1.  
From connecting to my database via ssh I got:-

mysql\> show variables like ‘c%’;  
±-------------------------±---------------------------+  
| Variable\_name |  
Value |  
±-------------------------±---------------------------+  
| character\_set\_client |  
latin1 |  
| character\_set\_connection | latin1 |  
| character\_set\_database | latin1  
|  
| character\_set\_filesystem | binary  
|  
| character\_set\_results |  
latin1 |  
| character\_set\_server |  
latin1 |  
| character\_set\_system |  
utf8 |  
| character\_sets\_dir | /usr/share/mysql/charsets/ |  
| collation\_connection | latin1\_swedish\_ci  
|  
| collation\_database | latin1\_swedish\_ci  
|  
| collation\_server |  
latin1\_swedish\_ci |  
| completion\_type |  
0 |  
| concurrent\_insert |  
1 |  
| connect\_timeout |  
10 |  
±-------------------------±---------------------------+  
14 rows in set (0.00 sec)

Great I thought, but when I use phpMyAdmin to issue the same command I  
got:-

show variables like ‘c%’;

Variable\_name Value  
character\_set\_client utf8  
character\_set\_connection utf8  
character\_set\_database latin1  
character\_set\_filesystem binary  
character\_set\_results utf8  
character\_set\_server latin1  
character\_set\_system utf8  
character\_sets\_dir /usr/share/mysql/charsets/  
collation\_connection utf8\_general\_ci  
collation\_database latin1\_swedish\_ci  
collation\_server latin1\_swedish\_ci  
completion\_type 0  
concurrent\_insert 1  
connect\_timeout 10

Perhaps when I sort this out I will reach my ultimate goal of entering  
text in phpMyAdmin and having it displayed on my website correctly.

Many thanks for all the help it has got me this far and now I have  
hope I will solve the problem in the end.  
Don

---

<div class="post-metadata">

**Author:** ![dmcclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dmcclean](https://www.ruby-forum.com/u/dmcclean)\
**Post date:** [September 20, 2010, 12:51pm UTC](https://www.ruby-forum.com/t/update-to-website-not-printing-special-characters/195241/2 "2010-09-20T12:51:32Z")

</div>

On 20 September 2010 11:45, MDM [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> the same, but reversed. What now happens is that the original text I  
> Latin1. I was going to change my w/site meta line to ISO 8859-1.  
> | character\_set\_database | latin1  
> | collation\_connection | latin1\_swedish\_ci  
> 10 |  
> character\_set\_client utf8  
> completion\_type 0  
> concurrent\_insert 1  
> connect\_timeout 10
> 
> Perhaps when I sort this out I will reach my ultimate goal of entering  
> text in phpMyAdmin and having it displayed on my website correctly.

If the only remaining problem is phpmyadmin then a better solution may  
be to provide some simple admin pages on your website for entering the  
data, and forget about phpmyadmin.

Colin

---

<div class="post-metadata">

**Author:** ![dmcclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dmcclean](https://www.ruby-forum.com/u/dmcclean)\
**Post date:** [September 20, 2010, 4:19pm UTC](https://www.ruby-forum.com/t/update-to-website-not-printing-special-characters/195241/3 "2010-09-20T16:19:46Z")

</div>

Don Mapp wrote:

> I thought you might be interested in how far I have got with solving  
> my problem with MySql(via phpMyAdmin) to website character\_set  
> problems.

Why did you start a new thread and make it harder to refer to the  
original problem?

For reference, the old thread is at  
[Printing special characters on screen in Ruby - Rails - Ruby-Forum](http://www.ruby-forum.com/topic/216878) .

> I thought I had solved the problem when my characters on my website  
> started showing the special characters.
> 
> This was a partial success though.
> 
> When I went back to phpMyAdmin and entered new text the problem was  
> the same, but reversed. What now happens is that the original text I  
> typed is now converted to gibberish(Latin1 to UTF8)

UTF8 is what you want to be using.

> and new text entered, in phpMyAdmin, is output to website as “?”  
> again  
> See:-
> 
> [http://donsgarden.co.uk/pests/228?telephone=2](http://donsgarden.co.uk/pests/228?telephone=2)
> 
> What I did, as I could not change the server Craracter\_set and  
> Collation (Shared Server). I got my host to change everything back to  
> Latin1.

Wait, wait, wait, wait. Why are you using a shared host (not generally  
a great idea for Rails)? Worse, why are you using a host that doesn’t  
let you change your own DB charset settings? Even shared hosting should  
let you do that. If not, find another hosting provider.

I was going to change my w/site meta line to ISO 8859-1.

> From connecting to my database via ssh I got:-
> 
> mysql\> show variables like ‘c%’;  
> ±-------------------------±---------------------------+  
> | Variable\_name |  
> Value |  
> ±-------------------------±---------------------------+  
> | character\_set\_client |  
> latin1 |  
> | character\_set\_connection | latin1 |  
> | character\_set\_database | latin1  
> |  
> | character\_set\_filesystem | binary  
> |  
> | character\_set\_results |  
> latin1 |  
> | character\_set\_server |  
> latin1 |  
> | character\_set\_system |  
> utf8 |  
> | character\_sets\_dir | /usr/share/mysql/charsets/ |  
> | collation\_connection | latin1\_swedish\_ci  
> |  
> | collation\_database | latin1\_swedish\_ci  
> |  
> | collation\_server |  
> latin1\_swedish\_ci |  
> | completion\_type |  
> 0 |  
> | concurrent\_insert |  
> 1 |  
> | connect\_timeout |  
> 10 |  
> ±-------------------------±---------------------------+  
> 14 rows in set (0.00 sec)
> 
> Great I thought, but when I use phpMyAdmin to issue the same command I  
> got:-
> 
> show variables like ‘c%’;
> 
> Variable\_name Value  
> character\_set\_client utf8  
> character\_set\_connection utf8  
> character\_set\_database latin1  
> character\_set\_filesystem binary  
> character\_set\_results utf8  
> character\_set\_server latin1  
> character\_set\_system utf8  
> character\_sets\_dir /usr/share/mysql/charsets/  
> collation\_connection utf8\_general\_ci  
> collation\_database latin1\_swedish\_ci  
> collation\_server latin1\_swedish\_ci  
> completion\_type 0  
> concurrent\_insert 1  
> connect\_timeout 10

Yuck! That’s really inconsistent. Change it all to UTF-8.

> Perhaps when I sort this out I will reach my ultimate goal of entering  
> text in phpMyAdmin and having it displayed on my website correctly.

I agree with Colin – don’t worry too much about phpMyAdmin. Worry  
about the actual DB. If you want to build an admin tool quickly, try  
ActiveScaffold.

And follow the advice in the older thread. It will stand you in better  
stead than what you’ve actually done.

> Many thanks for all the help it has got me this far and now I have  
> hope I will solve the problem in the end.

You will – if you actually _take_ the advice given to you. 🙂

> Don

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![dmcclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dmcclean](https://www.ruby-forum.com/u/dmcclean)\
**Post date:** [September 20, 2010, 5:19pm UTC](https://www.ruby-forum.com/t/update-to-website-not-printing-special-characters/195241/4 "2010-09-20T17:19:40Z")

</div>

Thanks Colin  
That’s what my son is hitting me over the head with.  
He dosn’t want to help as he said I should have used ROR to enter the  
data,  
which should have avoided all these problems.  
Mind you If I had done that I would not have learned so much about  
Encoding.  
When I re-write in ROR 3 and Ruby 1.9.x I plan to do that.  
Don

---

<div class="post-metadata">

**Author:** ![dmcclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dmcclean](https://www.ruby-forum.com/u/dmcclean)\
**Post date:** [September 20, 2010, 5:35pm UTC](https://www.ruby-forum.com/t/update-to-website-not-printing-special-characters/195241/5 "2010-09-20T17:35:59Z")

</div>

Please quote when replying. The discussion is hard to follow if you  
don’t.

Don Mapp wrote:

> Thanks guys for all the support and advice.  
> Yep I would have preferred to use UFT8

Then do! Convert what data you have that’s encoded differently (iconv  
is your friend), and switch completely to UTF-8 (not UFT8).

[…]

> Anyway now I am this far I want to solve this the hard way.

What do you consider to be the hard way? Often the hard way is actually  
the wrong way. If it’s not easy, you’re usually doing something wrong.

> That way I will learn so much more about these various technologies.  
> Don

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![dmcclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dmcclean](https://www.ruby-forum.com/u/dmcclean)\
**Post date:** [September 20, 2010, 5:09pm UTC](https://www.ruby-forum.com/t/update-to-website-not-printing-special-characters/195241/6 "2010-09-20T17:09:43Z")

</div>

Thanks guys for all the support and advice.  
Yep I would have preferred to use UFT8 and if I did do another ROR  
project I would do it differently,  
But having started learning ROR a few years ago I have gradually built  
up the website piecemeal.  
And At the mo I am still a relative newbie and sometimes it is better  
the devil you know.  
One day when I have time I will re-write the whole project and look  
for a different host.  
Ruby 1.9.2 and Ruby on Rails 3 beckon soon. I still think 1.9.2 needs  
a little settling down.  
Anyway now I am this far I want to solve this the hard way.  
That way I will learn so much more about these various technologies.  
Don
