RE: [PHP-DB] Special Character

2006-11-23 Thread David Skyers
Hi Chris,

Yes, I was using htmlentities, I have now removed that and now 

'De l'Âge du fer au haut Moyen Âge.'

gets inserted into oracle as
 
'De l'Bge du fer au haut Moyen Bge.'  

Any ideas?

David
-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: 22 November 2006 21:17
To: David Skyers
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Special Character

David Skyers wrote:
 Hi Kevin,
  
 Thanks for this, it got rid of my special characters. However I now have a 
 problem with foreign characters.
  
 Example
  
 'De l'Âge du fer au haut Moyen Âge.' 
  
 gets inserted into oracle as
  
 De l'Acirc;ge du fer au haut Moyen Acirc;ge.
  
 I have an oracle procedure that inserts the data, if I run the oracle 
 procedure directly in oracle it inserts the special characters okay. The 
 problem seems to be with the way php execute the procedure.

Are you calling htmlentities or htmlspecialchars before calling the procedure? 
That looks like what's happening.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Special Character

2006-11-23 Thread Vincent DUPONT
Hi,

You can maybe have a problem between a UTF-8 webserver and a ASCII (latin  or 
whatever) database?
Do you know the default_charset of your webserver (check the php.ini) and do 
you know the charset of your database? and the charset of your oracle client ? 
all 3 will play a role...

this : 'De l'Bge du fer au haut Moyen Bge.' really looks like inserting a 
UTF/unicode char into a ascii (latin, ...) database...


I think the best solution would be to keep the htmlentities to store the chars 
into the database, no?
this way would ensure you insert only 'simple' chars, at least as long as you 
do not enter chinese or foreign chars in your website.

vincent



-Original Message-
From: David Skyers [mailto:[EMAIL PROTECTED]
Sent: Thu 23/11/2006 10:29
To: Chris
Cc: php-db@lists.php.net
Subject: RE: [PHP-DB] Special Character
 
Hi Chris,

Yes, I was using htmlentities, I have now removed that and now 

'De l'Âge du fer au haut Moyen Âge.'

gets inserted into oracle as
 
'De l'Bge du fer au haut Moyen Bge.'  

Any ideas?

David
-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: 22 November 2006 21:17
To: David Skyers
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Special Character

David Skyers wrote:
 Hi Kevin,
  
 Thanks for this, it got rid of my special characters. However I now have a 
 problem with foreign characters.
  
 Example
  
 'De l'Âge du fer au haut Moyen Âge.' 
  
 gets inserted into oracle as
  
 De l'Acirc;ge du fer au haut Moyen Acirc;ge.
  
 I have an oracle procedure that inserts the data, if I run the oracle 
 procedure directly in oracle it inserts the special characters okay. The 
 problem seems to be with the way php execute the procedure.

Are you calling htmlentities or htmlspecialchars before calling the procedure? 
That looks like what's happening.

--
Postgresql  php tutorials
http://www.designmagick.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Special Character

2006-11-22 Thread David Skyers
Hi Kevin,
 
Thanks for this, it got rid of my special characters. However I now have a 
problem with foreign characters.
 
Example 
 
'De l'Âge du fer au haut Moyen Âge.' 
 
gets inserted into oracle as 
 
De l'Acirc;ge du fer au haut Moyen Acirc;ge.
 
I have an oracle procedure that inserts the data, if I run the oracle procedure 
directly in oracle it inserts the special characters okay. The problem seems to 
be with the way php execute the procedure.
 
Any ideas?
 
David

  _  

From: Kevin Murphy [mailto:[EMAIL PROTECTED] 
Sent: 16 November 2006 16:45
To: David Skyers
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Special Character


A solution I use is to do apply this function to all POST data collected. The 
key here for your problem is the chr(150) and chr(151) that are replaced with a 
normal hyphen. This also takes care of MS Words Smart Quotes. If there are 
other MS Characters you need to convert, just add them to the pattern field as 
the numeric version, and then add one to the array what the replacement is.  

function sanitize($data)
{
  $pattern = array(chr(145),chr(146),chr(147),chr(148),chr(150),chr(151));
$replacements = array(',','','','-','--');
$data = str_replace($pattern,$replacements,$data);
$data = trim($data);
$data = preg_replace(/ +/,  , $data);
$data = addslashes($data);
return $data;
}




-- 
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326


On Nov 16, 2006, at 7:32 AM, David Skyers wrote:


Thanks,

The problem is, we will have hundreds of users using Microsoft Word and
we cannot switch it off for all of them. Ideally I need some type of
string replace function, so no matter what they enter it gets trapped an
replaced.

It's not the normal hyphens that cause a problem but the long hyphens.

Regards

David

-Original Message-
From: Dan Shirah [mailto:[EMAIL PROTECTED]
Sent: 16 November 2006 15:13
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Special Character

To turn off the auto formatting of hyphens:

In Microsoft Word 2003:

Open a new document.
Go to ToolsAuto Correct Options
Select the Auto Format As You Type tab Deselect the Hyphens (--) with
Dash (-) option.

Even though it says it will replace a double hyphen (--) with a Dash
(This is an em dash) it also does the same thing for a single hyphen
depending on the sentance structure.

Hope this helps!

Dan


On 11/16/06, Niel Archer [EMAIL PROTECTED] wrote:


Hi David

What you describe sounds like Word is auto replacing hyphens 
with
either
en- or em-dashes.  This is a configurable option in Word that 
often
defaults to on.  Try using double quotes, If they get switched 
to 66's
and 99's style quotes, then that is likely the problem.  I no 
longer
use MS Office for these and other reasons, so cannot tell you 
how to
switch off this formatting.  But it can be switched off, 
somewhere

within it.


The only other option I can think of would be to change your Db
character set to one that can accept these extended characters. 
That
might also mean changing some of Window's/Word's behaviour (to 
be
using
UTF-8 for example).

Niel

--
PHP Database Mailing List (http://www.php.net/) To unsubscribe, 
visit:
http://www.php.net/unsub.php








Re: [PHP-DB] Special Character

2006-11-22 Thread Chris

David Skyers wrote:

Hi Kevin,
 
Thanks for this, it got rid of my special characters. However I now have a problem with foreign characters.
 
Example 
 
'De l'Âge du fer au haut Moyen Âge.' 
 
gets inserted into oracle as 
 
De l'Acirc;ge du fer au haut Moyen Acirc;ge.
 
I have an oracle procedure that inserts the data, if I run the oracle procedure directly in oracle it inserts the special characters okay. The problem seems to be with the way php execute the procedure.


Are you calling htmlentities or htmlspecialchars before calling the 
procedure? That looks like what's happening.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Special Character

2006-11-22 Thread Vincent DUPONT

I you use a SQL adapter, like ADO, it could do the htmlentities it self...

However, if you would like to change this, note that oracle will consider some 
chars as 'special chars', like (if I remember well) the .
To be able to insert a string with these chars, you need to search/replace them 
by their ascii value (use the Oracle function chr()
This is specially true when inserting urls.

vincent


-Original Message-
From: Chris [mailto:[EMAIL PROTECTED]
Sent: Wed 22/11/2006 22:17
To: David Skyers
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Special Character
 
David Skyers wrote:
 Hi Kevin,
  
 Thanks for this, it got rid of my special characters. However I now have a 
 problem with foreign characters.
  
 Example 
  
 'De l'Âge du fer au haut Moyen Âge.' 
  
 gets inserted into oracle as 
  
 De l'Acirc;ge du fer au haut Moyen Acirc;ge.
  
 I have an oracle procedure that inserts the data, if I run the oracle 
 procedure directly in oracle it inserts the special characters okay. The 
 problem seems to be with the way php execute the procedure.

Are you calling htmlentities or htmlspecialchars before calling the 
procedure? That looks like what's happening.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Special Character

2006-11-16 Thread Niel Archer
Hi

Is it really a hyphen, or is it an en- or em-dash.  The latter two could
mess up in in some character sets.

Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Special Character

2006-11-16 Thread David Skyers
Hi Niel

That's the problem I don't know what it is, but I do know that I press
the hyphen/minus key on my keyborad. If I type in 'The -' then press
enter and copy and paste this from word, it then gets displayed as
question mark in Oracle.

David

 

-Original Message-
From: Niel Archer [mailto:Niel Archer] On Behalf Of Niel Archer
Sent: 16 November 2006 13:26
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Special Character

Hi

Is it really a hyphen, or is it an en- or em-dash.  The latter two could
mess up in in some character sets.

Niel

--
PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Special Character

2006-11-16 Thread Niel Archer
Hi David

What you describe sounds like Word is auto replacing hyphens with either
en- or em-dashes.  This is a configurable option in Word that often
defaults to on.  Try using double quotes, If they get switched to 66's
and 99's style quotes, then that is likely the problem.  I no longer use
MS Office for these and other reasons, so cannot tell you how to switch
off this formatting.  But it can be switched off, somewhere within it. 

The only other option I can think of would be to change your Db
character set to one that can accept these extended characters. That
might also mean changing some of Window's/Word's behaviour (to be using
UTF-8 for example).

Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Special Character

2006-11-16 Thread Dan Shirah

To turn off the auto formatting of hyphens:

In Microsoft Word 2003:

Open a new document.
Go to ToolsAuto Correct Options
Select the Auto Format As You Type tab
Deselect the Hyphens (--) with Dash (-) option.

Even though it says it will replace a double hyphen (--) with a Dash (This
is an em dash) it also does the same thing for a single hyphen depending on
the sentance structure.

Hope this helps!

Dan


On 11/16/06, Niel Archer [EMAIL PROTECTED] wrote:


Hi David

What you describe sounds like Word is auto replacing hyphens with either
en- or em-dashes.  This is a configurable option in Word that often
defaults to on.  Try using double quotes, If they get switched to 66's
and 99's style quotes, then that is likely the problem.  I no longer use
MS Office for these and other reasons, so cannot tell you how to switch
off this formatting.  But it can be switched off, somewhere within it.

The only other option I can think of would be to change your Db
character set to one that can accept these extended characters. That
might also mean changing some of Window's/Word's behaviour (to be using
UTF-8 for example).

Niel

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Special Character

2006-11-16 Thread David Skyers
Thanks,

The problem is, we will have hundreds of users using Microsoft Word and
we cannot switch it off for all of them. Ideally I need some type of
string replace function, so no matter what they enter it gets trapped an
replaced.

It's not the normal hyphens that cause a problem but the long hyphens.

Regards

David

-Original Message-
From: Dan Shirah [mailto:[EMAIL PROTECTED]
Sent: 16 November 2006 15:13
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Special Character

To turn off the auto formatting of hyphens:

In Microsoft Word 2003:

Open a new document.
Go to ToolsAuto Correct Options
Select the Auto Format As You Type tab Deselect the Hyphens (--) with
Dash (-) option.

Even though it says it will replace a double hyphen (--) with a Dash
(This is an em dash) it also does the same thing for a single hyphen
depending on the sentance structure.

Hope this helps!

Dan


On 11/16/06, Niel Archer [EMAIL PROTECTED] wrote:

 Hi David

 What you describe sounds like Word is auto replacing hyphens with
 either
 en- or em-dashes.  This is a configurable option in Word that often
 defaults to on.  Try using double quotes, If they get switched to 66's
 and 99's style quotes, then that is likely the problem.  I no longer
 use MS Office for these and other reasons, so cannot tell you how to
 switch off this formatting.  But it can be switched off, somewhere
within it.

 The only other option I can think of would be to change your Db
 character set to one that can accept these extended characters. That
 might also mean changing some of Window's/Word's behaviour (to be
 using
 UTF-8 for example).

 Niel

 --
 PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php






Re: [PHP-DB] Special Character

2006-11-16 Thread Niel Archer
Hi David

off the top of my head, the best I can suggest is using PHP's MB
functions (lookup mb_string) to allow recognition and then convert them
to hyphens.

Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Special Character

2006-11-16 Thread Niel Archer
Hi

Doh... that's 'mbstring'

Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Special Character

2006-11-16 Thread Kevin Murphy
A solution I use is to do apply this function to all POST data  
collected. The key here for your problem is the chr(150) and chr(151)  
that are replaced with a normal hyphen. This also takes care of MS  
Words Smart Quotes. If there are other MS Characters you need to  
convert, just add them to the pattern field as the numeric version,  
and then add one to the array what the replacement is.


function sanitize($data)
{
  	$pattern = array(chr(145),chr(146),chr(147),chr(148),chr(150),chr 
(151));

$replacements = array(',','','','-','--');
$data = str_replace($pattern,$replacements,$data);
$data = trim($data);
$data = preg_replace(/ +/,  , $data);
$data = addslashes($data);
return $data;
}



--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326


On Nov 16, 2006, at 7:32 AM, David Skyers wrote:


Thanks,

The problem is, we will have hundreds of users using Microsoft Word  
and

we cannot switch it off for all of them. Ideally I need some type of
string replace function, so no matter what they enter it gets  
trapped an

replaced.

It's not the normal hyphens that cause a problem but the long hyphens.

Regards

David

-Original Message-
From: Dan Shirah [mailto:[EMAIL PROTECTED]
Sent: 16 November 2006 15:13
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Special Character

To turn off the auto formatting of hyphens:

In Microsoft Word 2003:

Open a new document.
Go to ToolsAuto Correct Options
Select the Auto Format As You Type tab Deselect the Hyphens (--)  
with

Dash (-) option.

Even though it says it will replace a double hyphen (--) with a Dash
(This is an em dash) it also does the same thing for a single hyphen
depending on the sentance structure.

Hope this helps!

Dan


On 11/16/06, Niel Archer [EMAIL PROTECTED] wrote:


Hi David

What you describe sounds like Word is auto replacing hyphens with
either
en- or em-dashes.  This is a configurable option in Word that often
defaults to on.  Try using double quotes, If they get switched to  
66's

and 99's style quotes, then that is likely the problem.  I no longer
use MS Office for these and other reasons, so cannot tell you how to
switch off this formatting.  But it can be switched off, somewhere

within it.


The only other option I can think of would be to change your Db
character set to one that can accept these extended characters. That
might also mean changing some of Window's/Word's behaviour (to be
using
UTF-8 for example).

Niel

--
PHP Database Mailing List (http://www.php.net/) To unsubscribe,  
visit:

http://www.php.net/unsub.php









Re: [PHP-DB] special character in filename

2003-06-10 Thread Becoming Digital
I can't explain why addslashes() didn't work (incorrect placement in the script,
perhaps), but take a look at htmlspecialchars() and htmlentities().  They're
long shots, but they might help.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ole Hornauer [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, 08 June, 2003 13:14
Subject: [PHP-DB] special character in filename


hi,

since i got my mp3 code somewhat working (was my fault, sorry guys), i
encountered another problem that i simply cant solve on my own.
im scanning mp3 files in a directory to put the data into a mysql
database.
everything works fine except that those files that have inverted commas
(maybe also other special characters?) as part of the filename are being
ignored by the script. i tried to use addslashes() but that didn't help
either. i included a test (echo $dir.$file) to see what exactly would be
inside the variables. but it looked ok.
could anybody give me a hint? i just dont get it.

here is my code. i included mphp3.php from http://res.crea-bmb.de/mphp3/
to scan for mp3 tags:

?
include(mphp3.php);

mysql_connect(192.168.100.12,user,password) or die (Keine
Verbindung moeglich);
mysql_select_db(mp3) or die (Die Datenbank existiert nicht);

scan_dir(mp3/);
echo Fertig;

function scan_dir($dir)
{
$handle = @opendir($dir);
while ($file = @readdir ($handle))
{
if (eregi(^\.{1,2}$,$file))
{
continue;
}

if(is_dir($dir.$file))
{
 scan_dir($dir.$file./);
}
else
{
$info = New mphp3(2);
 echo $dir.$file;
$info-load($dir.$file);
$abfrage =insert into mp3 (
  file,
  path,
  artist,
  title,
  album)
values (
 '$file',
 '$dir',
 '$info-v2_artist',
 '$info-v2_title',
 '$info-v2_album');;
mysql_query($abfrage);
}
}
@closedir($handle);
}
?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Special character on an INSERT statement

2001-08-28 Thread Andrey Hristov

Use addslashes() when inserting/updating the DB
use stripslashes() when extracting.

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
99%

- Original Message -
From: Jorge Giménez Mayorgas [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 28, 2001 7:48 PM
Subject: [PHP-DB] Special character on an INSERT statement


Hi .

I'm trying to do this on an INSERT statement.

$sql= INSERT  (' TONS OF CD'S ')
or any phrase with the character ' .
Obviously it gives an error when execeting mysql_query.

How can I do it ?

Thanks,

Jorge Giménez




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]