PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Detecting \u0000 in a string...
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Detecting \u0000 in a string...

Réponse
 
LinkBack Outils de la discussion
Vieux 17/03/2008, 12h56   #1
Mikey
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Detecting \u0000 in a string...

Hi!

I was wondering if anyone here had experienced a simliar problem to mine.

I am updating an Oracle XMLType column with XML built using DOM that is
populated with values from an Excel spreadsheet saved out as a CSV.

My problem is that for certain (apparently) random rows the xml updated
will fail with the error:

Warning: oci_execute(): OCIStmtExecute: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00217: invalid character 0 (\u0000)
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 5
ORA-06512: at line 1
in /path/ob/fu/scated/archive.inc on line 1374

I have googled around and a Java fix for the problem seemed to revolve
around a null char being left on the end of the XML string, so I tried
stripping the last char from the string but this did not . I then
used an ordUTF8 function I found in the manual notes to see if I could
find the null in the string - again, no luck.

So my question is whether or not anyone here has a reliable way of
detcting and removing \u0000 chars from strings?

regards,

Mikey
  Réponse avec citation
Vieux 17/03/2008, 23h28   #2
Casey
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Detecting \u0000 in a string...

On Mon, Mar 17, 2008 at 3:56 AM, Mikey <frak@upcore.net> wrote:
> Hi!
>
> I was wondering if anyone here had experienced a simliar problem to mine.
>
> I am updating an Oracle XMLType column with XML built using DOM that is
> populated with values from an Excel spreadsheet saved out as a CSV.
>
> My problem is that for certain (apparently) random rows the xml updated
> will fail with the error:
>
> Warning: oci_execute(): OCIStmtExecute: ORA-31011: XML parsing failed
> ORA-19202: Error occurred in XML processing
> LPX-00217: invalid character 0 (\u0000)
> Error at line 1
> ORA-06512: at "SYS.XMLTYPE", line 5
> ORA-06512: at line 1
> in /path/ob/fu/scated/archive.inc on line 1374
>
> I have googled around and a Java fix for the problem seemed to revolve
> around a null char being left on the end of the XML string, so I tried
> stripping the last char from the string but this did not . I then
> used an ordUTF8 function I found in the manual notes to see if I could
> find the null in the string - again, no luck.
>
> So my question is whether or not anyone here has a reliable way of
> detcting and removing \u0000 chars from strings?
>
> regards,
>
> Mikey
>
> --


How about:
$str = str_replace("\0", '', $str);

-Casey
  Réponse avec citation
Vieux 19/03/2008, 15h42   #3
Mikey
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Detecting \u0000 in a string...

Casey wrote:
> On Mon, Mar 17, 2008 at 3:56 AM, Mikey <frak@upcore.net> wrote:
>> Hi!
>>
>> I was wondering if anyone here had experienced a simliar problem to mine.
>>
>> I am updating an Oracle XMLType column with XML built using DOM that is
>> populated with values from an Excel spreadsheet saved out as a CSV.
>>
>> My problem is that for certain (apparently) random rows the xml updated
>> will fail with the error:
>>
>> Warning: oci_execute(): OCIStmtExecute: ORA-31011: XML parsing failed
>> ORA-19202: Error occurred in XML processing
>> LPX-00217: invalid character 0 (\u0000)
>> Error at line 1
>> ORA-06512: at "SYS.XMLTYPE", line 5
>> ORA-06512: at line 1
>> in /path/ob/fu/scated/archive.inc on line 1374
>>
>> I have googled around and a Java fix for the problem seemed to revolve
>> around a null char being left on the end of the XML string, so I tried
>> stripping the last char from the string but this did not . I then
>> used an ordUTF8 function I found in the manual notes to see if I could
>> find the null in the string - again, no luck.
>>
>> So my question is whether or not anyone here has a reliable way of
>> detcting and removing \u0000 chars from strings?
>>
>> regards,
>>
>> Mikey
>>
>> --

>
> How about:
> $str = str_replace("\0", '', $str);
>
> -Casey


You would think wouldn't you? I even tried asc(0) to no avail.

Well, my problem for now has gone away as an ammended version of the
spreadsheet did not have these errors, but a weird one, without a doubt!

Mikey
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h20.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14279 seconds with 11 queries