So what's happening in the controller, that might change it?

Are you using commands or modules that work only with octets instead of UTF-8?

my $octets = encode("UTF-8", $utf8_string);
...converts UTF-8 to Octets.

my $utf8_string = decode("UTF-8", $octets);
...converts Octets to UTF-8.

I put...
use Encode qw(decode encode); the start of my controller to use these functions.

My UTF-8 boiler plate for my Catalyst Controllers is:

use  strict;
use  warnings;
use  Moose;
use  namespace::autoclean;

use  utf8;
use  v5.30;
use  warnings (
   'FATAL', #makes anything in this list fatal
   'utf8',  #utf8 is a warnings category. 

use  Encode 

...and any other specific modules I need, I put in the specific bit.

The reason I use...
use v5.30; because it enables for following features:

unicode_strings (auto-enabled with "use v5.12;" or higher),
unicode_eval (auto-enabled with "use v5.16;" or higher),
fc (auto-enabled with "use v5.16;" or higher).

I guess I could just use v5.16, haha.
I use v5.30 because it's fun to be working with the latest Perl, =).

There are two webpages I found useful for understanding Perl and Unicode:

However, I do not know if it is a Perl and Unicode issue.
It could be a MySQL issue,
it could be a really simple mistake somewhere in the code, etc,
it could be the other module you're using, etc.

Until you share more context,
it's difficult to know what the problem could be.
Even then, I'm not an expert at character codes, ^_^.
I do hope someone in this list can help you though,
and everything works out, =).

  ----- Original Message ----- 
  From: Theo Bot 
  To: The elegant MVC web framework 
  Sent: Monday, February 10, 2020 1:22 PM
  Subject: [Catalyst] Encoding


  I created a controller that requests data from a mysql database via another 
module. The data in this case is a place in Germany called "M√ľnster". In the 
module that requests the data from mysql, with the mysql_enable_utf8 flag set 
to 1,  it is still correct just before it is returned to the catalyst 
controller. But what it arrives in the controller someting has changed. The 
original character values are:
  77 - 252 - 110 - 115 - 116  - 101 - 114

  But when they arrive in the controller it has changed into

  77 - 195 - 188 - 110 - 115 - 116 - 101 - 114

  And becomes unreadable. How do I handle this?


  Kind regards



  Searchable archive:
  Dev site:

Searchable archive:
Dev site:

Reply via email to