Why is Encode::decode('UTF-8', $var) still needed when everything is already in UTF-8?

You might find these two threads interesting.

To get utf-8 properly from database you need on connection explicitly tell it: my $dbh = DBI->connect( "dbi:mysql:dbname=$db;host=localhost", "user", "pwd", {mysql_enable_utf8 => 1 }) As I asked in my question here, there are still some problems with it, but in most cases it works fine. To answer "why"-part is much harder. As Denis pointed, there was pretty heavy thread about "why" recently.

Maybe it helps you understand related things. I suggest to use utf8::all` module to get utf-8 handling much easier and cleaner.

Internally, your database will presumably keep all data in a fixed-with, raw format, usually UCS-4 (i.e. Raw strings of 32-bit integers holding one codepoint each). UTF8 is an encoding, and encodings are only used when serializing data (e.g.In a file or database).

Deserializing, i.e. Reading, means to decode the encoded data and retrieve the raw codepoint string. Just because you happen to use the same encoding for all your serialization needs doesn't prevent you from decoding when loading and encoding when writing.

2 Not true in a mySQL database: Data declared as UTF-8 is stored as UTF-8. – Pekka Jun 26 '11 at 20:19 also, the storage may be irrelevant if the access api deals with recoding characters to the client's expectations; that may even be part of the client/server network protocol. – araqnid Jun 26 '11 at 20:25 It would be very cumbersome for any framework to maintain an internal string buffer in a particular multibyte encoding ... how would you do string length computations?

You couldn't even be sure that the data you read is valid. Perhaps some programs do, but others may not. – Kerrek SB Jun 26 '11 at 20:27 "It would be very cumbersome for any framework to maintain an internal string buffer in a particular multibyte encoding" - Ruby 1.9 does exactly that: each string has its own encoding property, and calling its length method deals with it accordingly.

– Denis Jun 26 '11 at 5:36.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions