[DTOWN - Wed Aug 3 15:25:39 2005]:
Show quoted text> You never replied with the version of Perl and Net::SNMP. But from
what
Show quoted text> I can reproduce, you are probably running Perl 5.6.1 and Net::SNMP
prior
Show quoted text> to 5.0.0.
Sorry about that. While I thought this was a new problem, rather than
something well-known, I was planning to produce a cut-down test case
with all the details of environment etc. However, I suspect you're
correct about the UTF-8 :-) ... To that end, here are the versions:
/data/perl/bin/perl -v
This is perl, v5.6.1 built for sun4-solaris
Copyright 1987-2001, Larry Wall
....
# -*- mode: perl -*-
#
========================================================================
====
package Net::SNMP;
# $Id: SNMP.pm,v 4.8 2003/09/11 19:14:42 dtown Exp $
# Copyright (c) 1998-2003 David M. Town <dtown@cpan.org>
# All rights reserved.
Show quoted text> The handling of UFT8 strings in Perl 5.6.1 was not really ready for
> prime time. A prepend call to substr() in Perl 5.6.1 with a UFT8
string
Show quoted text> would result in "garbage" being added to the string. When the
> Net::SNMP module builds a packet it uses prepend calls to substr().
I was not aware that any of the data I was getting was UTF-8 (I am
now!). The XML
requests I'm generating are going to a new 'Box' and there is scant
little documentation about the return codes etc ... mind you, had they
said it was UTF-8, I might well have missed it :-) !
Show quoted text> The "untainting" example you provided actually "changes" the string
from
Show quoted text> a UFT8 string to a regular string (in 5.6.1).
Ahh! ... as a matter of interest, how could I have found that out
(without you telling me)? ... I guess this is new 'side-effect' (in
X3J11 sense) of RE that started happening with utf-8 support?
Show quoted text> You can also add the line
> "use bytes;" to your script which tells Perl to treat all strings as
> plain ASCII characters. This line was added to Net::SNMP in v5.0.0.
Will that help? The XML service IS (I now realise) sending me UTF-8
codes. Now in this example it is in the 'ASCII range' but they also
send textual error messages, which I guess might include some those new
new (horrrible) quotes. I did also consider using UTF8STRING on varbinds
but I guess from what you're saying that won't help.
I guess I need to CONVERT from UTF-8 to say 8859-1. This is sorta what
you're saying the 'untainting' bit does ... so what would happen if that
untainting code met a non-ascii char?
.
Thanks for all you help with, especially as it turns out to be my
screw-up :-)