in reply to Re^4: Text::CSV encoding parse()
in thread Text::CSV encoding parse()
Seconding afoken here — if you do not know, find out!
Try the hexdump function from this sample: (lightly tested, hopefully correct)
hexdump-test.pl:#!/usr/bin/perl use strict; use warnings; # given: string of bytes # return: hexdump of argument sub hexdump ($) { use bytes; my @bytes = map {[$_, ord]} split //, shift; return '['.join(' ', map {sprintf('%02x', $_->[1])} @bytes).']' .'|'.join('', map { ($_->[1] >= 0x20 && $_->[1] < 0x7F) ? $_->[0] : '.' } @bytes).'|' } use utf8; my $text = q[search/¿Cuales son las partes de una cadena de conexión?? +scope]; print hexdump($text), "\n"; __END__
Sample output:
[73 65 61 72 63 68 2f c2 bf 43 75 61 6c 65 73 20 73 6f 6e 20 6c 61 73 +20 70 61 72 74 65 73 20 64 65 20 75 6e 61 20 63 61 64 65 6e 61 20 64 +65 20 63 6f 6e 65 78 69 c3 b3 6e 3f 3f 73 63 6f 70 65]|search/..Cuale +s son las partes de una cadena de conexi..n??scope|
I am fairly sure that if hexdump dies, the string you gave it was definitely not UTF-8. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Text::CSV encoding parse()
by afoken (Chancellor) on Aug 15, 2019 at 17:38 UTC | |
by jcb (Parson) on Aug 15, 2019 at 22:33 UTC |