in reply to Re^2: Perl encoding problem
in thread Perl encoding problem
Thank you very much for your additional comments.
The scripts have not changed but the Perl version and the locale of the server. These are the variables I thought to be the reason for my problems.
The migration to a mySQL UTF8 DB is one big target but there is a bunch of things I will have to modify to achieve this.
The migration of the server is one first step.
The diffuculties I am having now help me to prepare the next steps - hopefully.
I have a couple of files with different encodings that all end up in the database
which is at the moment latin1_swedish_ci and will be some utf8 sometimes.
All migrated scripts and files worked fine so far and the first problem occured with the regex with the foreign characters in this script.
foreach my $key (keys %$add) { $add->{$key} = encode('iso-8859-1', $add->{$key}, 1); }
which is what I would have expected to be done originally.
The outcome of the encoding is that all lines with foreign characters do not appear in the database anymore.
I get "Incorrect string value: '\xE4lter'" for example.
Without the encoding all lines are added in the database and all of them look alright.
So as far as I understand you my first assumption of the encoding of the strings in $add is wrong and I should not just insert them into a latin1_swedish_ci DB.
On the other hand encoding them produces errors during the import into a database with latin1_swedish_ci collation.
So I am having another problem I donīt yet understand yet.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl encoding problem
by NERDVANA (Priest) on Dec 15, 2021 at 14:17 UTC |