Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
0ee02c02
Commit
0ee02c02
authored
Dec 30, 2006
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 363371: It is hard to determine which row has a failed encoding, with recode.pl --guess
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=justdave, a=justdave
parent
c712d457
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
recode.pl
contrib/recode.pl
+11
-2
No files found.
contrib/recode.pl
View file @
0ee02c02
...
...
@@ -251,6 +251,13 @@ foreach my $table ($dbh->bz_table_list_real) {
my
$data
=
shift
@result
;
my
$digest
=
md5_base64
(
$data
);
my
@primary_keys
=
reverse
split
(
','
,
$pk
);
# We copy the array so that we can pop things from it without
# affecting the original.
my
@pk_data
=
@result
;
my
$pk_line
=
join
(
', '
,
map
{
"$_ = "
.
pop
@pk_data
}
@primary_keys
);
my
$encoding
;
if
(
$switch
{
'guess'
})
{
$encoding
=
do_guess
(
$data
);
...
...
@@ -261,7 +268,8 @@ foreach my $table ($dbh->bz_table_list_real) {
&&
!
is_valid_utf8
(
$data
))
{
my
$truncated
=
trunc
(
$data
);
print
"Failed to guess: Key: $digest"
,
print
"Row: [$pk_line]\n"
,
"Failed to guess: Key: $digest"
,
" DATA: $truncated\n"
;
}
...
...
@@ -283,7 +291,8 @@ foreach my $table ($dbh->bz_table_list_real) {
if
(
$encoding
&&
!
grep
(
$_
eq
$encoding
,
IGNORE_ENCODINGS
))
{
my
$decoded
=
encode
(
'utf8'
,
decode
(
$encoding
,
$data
));
if
(
$switch
{
'dry-run'
}
&&
$data
ne
$decoded
)
{
print
"From: ["
.
trunc
(
$data
)
.
"] Key: $digest\n"
,
print
"Row: [$pk_line]\n"
,
"From: ["
.
trunc
(
$data
)
.
"] Key: $digest\n"
,
"To: ["
.
trunc
(
$decoded
)
.
"]"
,
" Encoding : $encoding\n"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment