Page 1 of 1

Diffrent Encoding

Posted: Wed Nov 16, 2005 10:07 am
by onlinedrivingtest
I have this problem that I do not know the encoding of the text I am working with. This makes it difficult to work with mysql as the diffrent encoding can mess up my database.

Whats the best way to do this?

Posted: Wed Nov 16, 2005 10:27 am
by Weirdan
Obviously, the best way is to know what is encoding you're working with.

It means you need either:
  • detect encoding of incoming data; or
  • force particular encoding for incoming data
, whichever suits better, depending on the nature of your application.

Posted: Wed Nov 16, 2005 10:37 am
by jayshields
I may be way off here, but I think that he means the way his text editor encoded PHP files.

I have had this problem before, where if I don't save in ANSI encoding then it just outputs chinese characters when I run the script on my server.

Anyway, if you do mean that, just make sure you Save As everytime you're uncertain and choose ANSI encoding, that's what I do.

If you don't mean anything like the above, don't listen to me :)

Posted: Wed Nov 16, 2005 1:01 pm
by JAM
jayshields wrote:I may be way off here, but I think that he means the way his text editor encoded PHP files.

I have had this problem before, where if I don't save in ANSI encoding then it just outputs chinese characters when I run the script on my server.

Anyway, if you do mean that, just make sure you Save As everytime you're uncertain and choose ANSI encoding, that's what I do.

If you don't mean anything like the above, don't listen to me :)
Weither you are correct or not, this is still an interesting subject. But please do note what editor you are using for future reference. It often a setting in the editor itself tha might cause this. In an win32 enviroment I use UltraEdit. A flick of a checkbox will create the problem you just described, but in a Linux enviroment I never have these issues.

( Please, do not turn this into a thread about what editor is the better. :wink: We have a thread for this. )

Posted: Thu Nov 17, 2005 2:33 pm
by onlinedrivingtest
No it isnt my editor.

I have no way of knowing what encoding the text i am working with is.

Sure i can force the encoding i wish but I am sure you have seen yourself what happens if you go on a chinese website all the letters go to crap.

Asfor a workaround Im working on it :)