Unrecognized character ... in column ...

Please be more specific in these error messages, as the user has no clue
which column 4 you mean:
$ perl -pwe 's/略x(.)/$1[略]/;' /dev/null
Unrecognized character \xE7 in column 4 at -e line 1.
$ perl -pwe '           s/略x(.)/$1[略]/;' /dev/null
Unrecognized character \xE7 in column 4 at -e line 1.
$ perl -pwe 's/略            x(.)/$1[略]/;' /dev/null
Unrecognized character \xE7 in column 4 at -e line 1.
$ perl -pwe 's/略x(.)/         $1[略]/;' /dev/null
Unrecognized character \xE7 in column 13 at -e line 1.
Ah, that column 4. (So the user should use \[.)
http://archives.devshed.com/forums/perl-102/adding-more-information-to-unrecognized-character-error-in-toke-c-2364957.html
0
jidanni
5/8/2009 10:40:21 PM
perl.perl5.porters 47902 articles. 1 followers. Follow

7 Replies
956 Views

Similar Articles

[PageSpeed] 57

Perhaps something like 'Unrecognized character \xE7 after '<4-5 =20
chars>' (column 4) at ...' would make more sense?

/Claes

On 9 maj 2009, at 00.40, Dan Jacobson wrote:

> Please be more specific in these error messages, as the user has no =20=

> clue
> which column 4 you mean:
> $ perl -pwe 's/=E7=95=A5x(.)/$1[=E7=95=A5]/;' /dev/null
> Unrecognized character \xE7 in column 4 at -e line 1.
> $ perl -pwe '           s/=E7=95=A5x(.)/$1[=E7=95=A5]/;' /dev/null
> Unrecognized character \xE7 in column 4 at -e line 1.
> $ perl -pwe 's/=E7=95=A5            x(.)/$1[=E7=95=A5]/;' /dev/null
> Unrecognized character \xE7 in column 4 at -e line 1.
> $ perl -pwe 's/=E7=95=A5x(.)/         $1[=E7=95=A5]/;' /dev/null
> Unrecognized character \xE7 in column 13 at -e line 1.
> Ah, that column 4. (So the user should use \[.)
> =
http://archives.devshed.com/forums/perl-102/adding-more-information-to-unr=
ecognized-character-error-in-toke-c-2364957.html

0
claes
5/8/2009 10:52:59 PM
Claes Jakobsson wrote:
> Perhaps something like 'Unrecognized character \xE7 after '<4-5 chars>'
> (column 4) at ...' would make more sense?

Or use a HERE tag like regex parse errors do.


-- 
Defender of Lexical Encapsulation
0
schwern
5/8/2009 11:29:13 PM
On 9 maj 2009, at 01.29, Michael G Schwern wrote:
> Claes Jakobsson wrote:
>> Perhaps something like 'Unrecognized character \xE7 after '<4-5  
>> chars>'
>> (column 4) at ...' would make more sense?
>
> Or use a HERE tag like regex parse errors do.

Even better. =)

How many characters before the unrecognized one should be included in  
the error?

/me fixes a patch as it's my fault to start with


Cheers,
Claes





0
claes
5/9/2009 7:51:19 AM
Claes Jakobsson wrote:
> On 9 maj 2009, at 01.29, Michael G Schwern wrote:
>> Claes Jakobsson wrote:
>>> Perhaps something like 'Unrecognized character \xE7 after '<4-5 chars>'
>>> (column 4) at ...' would make more sense?
>>
>> Or use a HERE tag like regex parse errors do.
> 
> Even better. =)
> 
> How many characters before the unrecognized one should be included in
> the error?

Could you clarify what you mean by that?


-- 
Life is like a sewer - what you get out of it depends on what you put into it.
    - Tom Lehrer
0
schwern
5/9/2009 8:36:30 PM
On 9 maj 2009, at 22.36, Michael G Schwern wrote:
> Claes Jakobsson wrote:
>> On 9 maj 2009, at 01.29, Michael G Schwern wrote:
>>> Claes Jakobsson wrote:
>>>> Perhaps something like 'Unrecognized character \xE7 after '<4-5  
>>>> chars>'
>>>> (column 4) at ...' would make more sense?
>>>
>>> Or use a HERE tag like regex parse errors do.
>>
>> Even better. =)
>>
>> How many characters before the unrecognized one should be included in
>> the error?
>
> Could you clarify what you mean by that?

In case the unrecognized character is for example the 56th on the line  
having everything before that in the HERE tag would result in a very  
long error being printed. I think a few characters (say max 10) and  
the column number would be sufficient to find the culprit character  
when fixing the problem.

Something like this

   Unrecognized character \xC2; marked by <-- HERE in 2 || $c == <--  
HERE near column 32 at -e line 1.

in case the source is (there's a utf8 no-break space after last ==)

   if ($a == 1 || $b == 2 || $c == 2) {

/Claes
0
claes
5/9/2009 9:00:24 PM
--Apple-Mail-5--216502112
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed;
	delsp=yes
Content-Transfer-Encoding: 7bit

Hi,

On 9 maj 2009, at 23.00, Claes Jakobsson wrote:
> On 9 maj 2009, at 22.36, Michael G Schwern wrote:
>> Claes Jakobsson wrote:
>>> On 9 maj 2009, at 01.29, Michael G Schwern wrote:
>>>> Claes Jakobsson wrote:
>>>>> Perhaps something like 'Unrecognized character \xE7 after '<4-5  
>>>>> chars>'
>>>>> (column 4) at ...' would make more sense?
>>>>
>>>> Or use a HERE tag like regex parse errors do.
>>>
>>> Even better. =)
>>>
>>> How many characters before the unrecognized one should be included  
>>> in
>>> the error?

attached is a patch that changes the error message to "Unrecognized  
character %s; marked by <-- HERE after %s<-- HERE near column %d"

This should make it a little simplier to spot and correct the  
suspicious character.

Patch is against blead.

Cheers,
Claes


--Apple-Mail-5--216502112
Content-Disposition: attachment;
	filename=unrecognized_character.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="unrecognized_character.patch"
Content-Transfer-Encoding: 7bit

diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index f2a4a1a..1dbb3e4 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -4423,10 +4423,10 @@ reserved word.  It's best to put such a word in quotes, or capitalize it
 somehow, or insert an underbar into it.  You might also declare it as a
 subroutine.
 
-=item Unrecognized character %s in column %d
+=item Unrecognized character %s; marked by <-- HERE after %s near column %d
 
 (F) The Perl parser has no idea what to do with the specified character
-in your Perl script (or eval) at the specified column.  Perhaps you tried 
+in your Perl script (or eval) near the specified column.  Perhaps you tried 
 to run a compressed script, a binary program, or a directory as a Perl program.
 
 =item Unrecognized escape \\%c in character class passed through in regex; marked by <-- HERE in m/%s/
diff --git a/t/base/lex.t b/t/base/lex.t
index 1b8045b..8cadf85 100755
--- a/t/base/lex.t
+++ b/t/base/lex.t
@@ -265,7 +265,7 @@ sub foo::::::bar { print "ok $test\n"; $test++ }
 foo::::::bar;
 
 eval "\$x =\xE2foo";
-if ($@ =~ /Unrecognized character \\xE2 in column 5/) { print "ok $test\n"; } else { print "not ok $test\n"; }
+if ($@ =~ /Unrecognized character \\xE2; marked by <-- HERE after \$x =<-- HERE near column 5/) { print "ok $test\n"; } else { print "not ok $test\n"; }
 $test++;
 
 # Is "[~" scanned correctly?
diff --git a/toke.c b/toke.c
index c803a80..3fda3a5 100644
--- a/toke.c
+++ b/toke.c
@@ -124,6 +124,9 @@ static I32 utf16rev_textfilter(pTHX_ int idx, SV *sv, int maxlen);
 #   define UTF ((PL_linestr && DO_UTF8(PL_linestr)) || (PL_hints & HINT_UTF8))
 #endif
 
+/* The maximum number of characters preceding the unrecognized one to display */
+#define UNRECOGNIZED_PRECEDE_COUNT 10
+
 /* In variables named $^X, these are the legal values for X.
  * 1999-02-27 mjd-perl-patch@plover.com */
 #define isCONTROLVAR(x) (isUPPER(x) || strchr("[\\]^_?", (x)))
@@ -3652,8 +3655,17 @@ Perl_yylex(pTHX)
     default:
 	if (isIDFIRST_lazy_if(s,UTF))
 	    goto keylookup;
-	len = UTF ? Perl_utf8_length(aTHX_ (U8 *) PL_linestart, (U8 *) s) : (STRLEN) (s - PL_linestart);
-	Perl_croak(aTHX_ "Unrecognized character \\x%02X in column %d", *s & 255, (int) len + 1);
+	{
+        unsigned char c = *s;
+        len = UTF ? Perl_utf8_length(aTHX_ (U8 *) PL_linestart, (U8 *) s) : (STRLEN) (s - PL_linestart);
+        if (len > UNRECOGNIZED_PRECEDE_COUNT) {
+            d = UTF ? (char *) Perl_utf8_hop(aTHX_ (U8 *) s, -UNRECOGNIZED_PRECEDE_COUNT) : s - UNRECOGNIZED_PRECEDE_COUNT;
+        } else {
+            d = PL_linestart;
+        }	
+        *s = '\0';
+        Perl_croak(aTHX_ "Unrecognized character \\x%02X; marked by <-- HERE after %s<-- HERE near column %d", c, d, (int) len + 1);
+    }
     case 4:
     case 26:
 	goto fake_eof;			/* emulate EOF on ^D or ^Z */

--Apple-Mail-5--216502112
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed
Content-Transfer-Encoding: 7bit



--Apple-Mail-5--216502112--
0
claes
5/13/2009 4:13:06 PM
2009/5/13 Claes Jakobsson <claes@surfar.nu>:
> attached is a patch that changes the error message to "Unrecognized
> character %s; marked by <-- HERE after %s<-- HERE near column %d"
>
> This should make it a little simplier to spot and correct the suspicious
> character.

Thanks, applied as b1fc363696b1a308e6bce75eb292bacc8f2c9833
0
rgarciasuarez
5/14/2009 2:13:16 PM
Reply:

Similar Artilces:

Re: Database Character Columns Longer than 255 Characters
Adebolade, Microsoft stopped support for its dblib based interface, which was used for the MSS native interface from PB. In new versions of PB, the driver used for SQL 2000 is OLE DB. I don't think PB 6.5 had that driver available, so you could try ODBC. I would recommend upgrading to a newer version of PowerBuilder since PB 6.5 is no longer a supported version. Sanjiv. -----Original Message----- From: Adebolade@mtnnigeria.net [mailto:Adebolade@mtnnigeria.net] Subject: Database Character Columns Longer than 255 Characters Hi, I use Powerbuilder 6.5 with SQL Se...

Unrecognized character
Hi! I'm have a big problem. I make a module(pm) and now i want compile this module. I tried use the perlcc but i receive the msg that the module can't be compiled because have shared libs. However i found a module, PAR(Perl Archive Toolkit) which can compile my module. Then, i was to install this module(PAR). After the instalation of module i run the command: $ pp -o compiled.pm -M Exporter module.pm ps.: The module.pm just require the lib Exporter. I not have problems with the compilation. Then the next step would be execute a script (CGI) that use the compile...

When is a column not a column?
I have several extremely similar datawindows that I have to maintain that go against the same table. Recently, I had to add a column to that table, and also add the column to ALL of these datawindows that go against this table. I added the column to the first datawindow, set up the edit control style, etc. I then did a copy/paste of the columns edit control to the remaining dw's (of course remembering to first add the column in SQL). Everything (update props, column specs, column props) seems to indicate that the pasted column is linked to the column I selected, HOWEVER, when I...

Unicoded CSV supports chinese characters but excell shows all columns in a single column (may be an excell unicode csv issue)
so i have the unicoded CSV that supports chinese but excel doesn't like it, it put all the columns into a single columns.  Any though? Response.Clear();Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentEncoding = Encoding.Unicode;Response.Charset = "Unicode"; Response.AddHeader("Content-Type", "text/csv");Response.AddHeader("Content-Disposition", "inline;filename=consultantList.csv");Response.BinaryWrite(Encoding.Unicode.GetPreamble()); Response.Write(csv.ToString()); Response.End();...

Thank you, perl5 porters!
I am happy to report that bleadperl 16147 has built successfully on VOS and has passed all of its tests. There is only one local patch, to vos.c, which is already in the repository but not in this snapshot. I may yet find more things to change, but this is an important milestone to me; this is the first time I've passed all of the tests on the first try. Whoopee!!! A thousand thanks to everyone who has assisted me in the effort to get perl 5.7 ported to the Stratus VOS operating system. I started working on this effort last October. If I had known how long it would take, or...

this decade on perl5-porters
As a side effect of something else, I found myself digging around in the archives of Perl5-Porters from quite a long time ago. For example, take a look at the archives from 10 years ago: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/9608/threads.html Several names you see there are still active today, and others are still in contact, which is nice. Although I was surprised to discover that Jarkko had a different .sig back then. Nicholas Clark ...

subscribe perl5-porters
subscribe perl5-porters ...

last character in the column
hi How can I know the last character typed in a column of a datawindow , as I need to wrap it to the next time . Autoheight does not works for the same -- Regards Van Try using the Right ( string, n ) String function within either ItemChanged or EditChanged event, or maybe a compute in the dw. HTH. "Van" <VanJacobson@hotmail.com> escribi� en el mensaje news:457faaba$1@forums-1-dub... > hi > How can I know the last character typed in a column of a datawindow , as > I need to wrap it to the next time . > Autoheight does not works fo...

This week on Perl5-porters
[Apologies for the unannounced leave of absence: the conference had me very busy. - SC] The HTML version will be up in a few hours (if it isn't already) at http://www.perl.com/pub/2001/08/p5pdigest/THISWEEK-20010815.html The current report is always available at http://www.perl.com/p5pdigest.cgi An RSS file of this week's report will be available at http://www.perl.com/pub/2001/08/p5pdigest/THISWEEK-20010815.rss The current RSS file is always available at http://www.perl.com/p5pdigest.cgi?s=rdf The archive of past reports: ...

where is the perl5-porters FAQ ?
On http://lists.cpan.org/showlist.cgi?name=perl5-porters there is link to the perl5-porters FAQ at http://simon-cozens.org/writings/p5p-faq which does not exist any more. Sending e-mail to perl5-porters-faq@perl.org still works so I have the document now but it would be good to update the link on that site. Gabor gabor@perl.org.il (Gabor Szabo) writes: > On > http://lists.cpan.org/showlist.cgi?name=perl5-porters > there is link to the perl5-porters FAQ at > http://simon-cozens.org/writings/p5p-faq > which does not exist any more. You could mail me about i...

Text column character limit ?
This is a multi-part message in MIME format. ------=_NextPart_000_0018_01C804DD.0C4F8280 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable PB 9.0.2 Build 7578 I have a simple datawindow column mapped to a sqlserver 2000 text = column set to use only a vertical scrollbar with no edit mask. It is = basically a notes field. =20 I have the Column Specification for that column set to char(32766) as it = was used in legacy via ODBC and that seemed to be a limit back then. = Now using OLEDB. =20 I have the Edit limit set to 3200...

Pasting from Word
When a user pastes text from a Word document that contains an apostrophe or double quote (and possibly other special characters), they are NOT the normal apostrophe or double quote. Example - normal apostrophe: ' Word pasted apostrophe: ‘ normal double quote: " Word pasted apostrophe: “ What can I do to convert these characters to something I can insert into my database, then read back out again? Right now, Oracle is converting them to upside down question marks and then they display as boxes in HTML.The aim of an argument or discussion should not be victory, but prog...

PB10
I just started playing with the eval version of PB10, using Microsoft SQL Server 2000 with OLEDB. I've noticed that all character strings are missing their last character when they are retrieved from the database. This only happens at runtime; it works fine in the DB painter and the DW painter. For example, a char(4) column with a value of CUST is retrieved as CUS. This also happens with varchar columns. Is this a bug, or is there something that I need to change in my DB connection parameters? I'm using the same parameters that worked for PB9: PROVIDER='SQLOLEDB'...

Column name begins with character %
I have a Microsoft Access table with a column name that begins with character %. When I try to make a dw to update that table i have some problems: - I configure ODBC for put quotes in columns and table names. (Syntax Tab in Database Profile) - In the query dw Painter I have to 'Convert to Sintax' for not have Syntax error 37000. PB translates: Select "table.column1", "table.%column2" from "table" with Select "table.column1", table.%column2 from "table" - In no graphic mode (convert t...

Web resources about - Unrecognized character ... in column ... - perl.perl5.porters

List of states with limited recognition - Wikipedia, the free encyclopedia
Some contemporary geopolitical entities that wish to be recognised as de jure sovereign states have been hindered by a lack of diplomatic recognition ...

Dark Eyes: "I feel nothing for their game, where beauty goes unrecognized..."
... purposes They tell me revenge is sweet and from where they stand, I'm sure it is But I feel nothing for their game, where beauty goes unrecognized ...

BLDGBLOG: Unrecognized for what they are
architectural conjecture :: urban speculation :: landscape futures

Clinton Goes Unrecognized At Chipotle
The Clinton campaign stopped for lunch at a Chipotle in suburban Ohio yesterday and the press is making a big deal because nobody there recognized ...

American Dream alive, but unrecognized
Only 25 percent of adults reported in the survey that they have been able to "make a lot of money" in their life.

Hillary Clinton goes unrecognized at Chipotle
... the restaurant's staff didn't recognize her. Breaking News CNN Sign in MyCNN 2016 Washington Nation World Our Team Hillary Clinton goes unrecognized ...

NFL Star Went Unrecognized During Hilarious Powerball Interview
NFL Star Went Unrecognized During Hilarious Powerball Interview

Two Unrecognized Hall Of Fame Shortstops
This article is dedicated to the memory of the late Clem Comly, who did more than anyone to put together the Retrosheet.org public database of ...

That Time Jennifer Aniston Went Unrecognized...at Target! "It Was Pretty Awesome!"
You'd think Jennifer Aniston would have to go to the most remote place on Earth to find people wh...

This Was the Last Time 'N Sync and the Spice Girls Went Completely Unrecognized
This Was the Last Time 'N Sync and the Spice Girls Went Completely Unrecognized

Resources last updated: 1/21/2016 7:52:34 PM