Обсуждение: Carriage Returns Disappearing

Поиск
Список
Период
Сортировка

Carriage Returns Disappearing

От
Дата:
hi all,

my users enter a note.  i would like to keep carriage
returns intact.  however, when i display the data, the
two carriage returns are lost and replaced with two
spaces.

i use adodb's qstr() fumction to handle my excaping
upon entry.

can anyone help me to keep these carriage returns
intact?

ironicly, i was asking about what to do about carriage
returns a while back b/c i saw them in my development
db.  uggh!

tia...



__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/

Re: Carriage Returns Disappearing

От
Volkan YAZICI
Дата:
Hi,

On 5/26/05, operationsengineer1@yahoo.com <operationsengineer1@yahoo.com> wrote:
> my users enter a note.  i would like to keep carriage
> returns intact.  however, when i display the data, the
> two carriage returns are lost and replaced with two
> spaces.
>
> i use adodb's qstr() fumction to handle my excaping
> upon entry.

There seems to be a problem with ADOdb's escaping PostgreSQL literals
routine, because it's commented out and ADOdb is using its default
qstr() routine. (I should check it in an suitable time.) Therefore, I
advice you to use pg_escape_string().

Regards.

P.S. I've traced to qstr() code but couldn't find the
adodb_str_replace() function in ADOdb source code used by qstr().
Thus, I cannot give a correct answer about where qstr() dumps your
problem.

Re: Carriage Returns Disappearing

От
Дата:
--- Volkan YAZICI <volkan.yazici@gmail.com> wrote:
> Hi,
>
> On 5/26/05, operationsengineer1@yahoo.com
> <operationsengineer1@yahoo.com> wrote:
> > my users enter a note.  i would like to keep
> carriage
> > returns intact.  however, when i display the data,
> the
> > two carriage returns are lost and replaced with
> two
> > spaces.
> >
> > i use adodb's qstr() fumction to handle my
> excaping
> > upon entry.
>
> There seems to be a problem with ADOdb's escaping
> PostgreSQL literals
> routine, because it's commented out and ADOdb is
> using its default
> qstr() routine. (I should check it in an suitable
> time.) Therefore, I
> advice you to use pg_escape_string().
>
> Regards.
>
> P.S. I've traced to qstr() code but couldn't find
> the
> adodb_str_replace() function in ADOdb source code
> used by qstr().
> Thus, I cannot give a correct answer about where
> qstr() dumps your
> problem.
>

i used pg_escape_string() and received the same
results.  the carriage returns are showing up as
stored in the db.  when select the data, though, the
carriage returns are replaced with a single space,
regardless if it is one return or 5 returns.

the sql seems to be pretty standard fare...

$sql_notes = "SELECT notes.assembly_notes
FROM t_product prod, t_link_product_assembly_notes
link, t_assembly_notes notes
WHERE link.product_id = prod.product_id
AND link.assembly_notes_id = notes.assembly_notes_id
AND link.product_id = " . $product_id;

i then send the array of values to another page where
this code displays the array...

$i=1;
foreach ($_SESSION['row_notes'] as $row)
{
print $i.". ".$row['assembly_notes']."<hr />";
$i++;
}

does anyone know why my carriage returns are not
displaying when i call the data?

is it because i send the array to another page via the
session variable?

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: Carriage Returns Disappearing

От
Дата:
it isn't a sessions issue...  i tested my code to the
same page and received the same single space for any
number of carriage returns in my varchar field.

--- operationsengineer1@yahoo.com wrote:
>
> --- Volkan YAZICI <volkan.yazici@gmail.com> wrote:
> > Hi,
> >
> > On 5/26/05, operationsengineer1@yahoo.com
> > <operationsengineer1@yahoo.com> wrote:
> > > my users enter a note.  i would like to keep
> > carriage
> > > returns intact.  however, when i display the
> data,
> > the
> > > two carriage returns are lost and replaced with
> > two
> > > spaces.
> > >
> > > i use adodb's qstr() fumction to handle my
> > excaping
> > > upon entry.
> >
> > There seems to be a problem with ADOdb's escaping
> > PostgreSQL literals
> > routine, because it's commented out and ADOdb is
> > using its default
> > qstr() routine. (I should check it in an suitable
> > time.) Therefore, I
> > advice you to use pg_escape_string().
> >
> > Regards.
> >
> > P.S. I've traced to qstr() code but couldn't find
> > the
> > adodb_str_replace() function in ADOdb source code
> > used by qstr().
> > Thus, I cannot give a correct answer about where
> > qstr() dumps your
> > problem.
> >
>
> i used pg_escape_string() and received the same
> results.  the carriage returns are showing up as
> stored in the db.  when select the data, though, the
> carriage returns are replaced with a single space,
> regardless if it is one return or 5 returns.
>
> the sql seems to be pretty standard fare...
>
> $sql_notes = "SELECT notes.assembly_notes
> FROM t_product prod, t_link_product_assembly_notes
> link, t_assembly_notes notes
> WHERE link.product_id = prod.product_id
> AND link.assembly_notes_id = notes.assembly_notes_id
> AND link.product_id = " . $product_id;
>
> i then send the array of values to another page
> where
> this code displays the array...
>
> $i=1;
> foreach ($_SESSION['row_notes'] as $row)
> {
> print $i.". ".$row['assembly_notes']."<hr />";
> $i++;
> }
>
> does anyone know why my carriage returns are not
> displaying when i call the data?
>
> is it because i send the array to another page via
> the
> session variable?
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com