List Info

Thread: Strategy for Handling Apostrophe's Consistently - PHP, JS, MySQL




Strategy for Handling Apostrophe's Consistently - PHP, JS, MySQL
country flaguser name
United States
2007-06-08 09:06:10
Folks, given a typical application using all of subject
languages/
tools, how do you handle apostrophe's consistently?
That is, given the availability of html entities, JS escape
functions,
the several php string functions as well as MySQL, I find
myself
stumbling around on an ad-hoc basis.

Has any of you a decently articulated strategy re when and
where you
perform needed conversions?

Maybe it all comes down to this:  What do you store in a
MySQL text
field, the apostrophe character or the html entity?  And
what
conversion functions do you use?

Thanks, all.

-AS


--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---


Re: Strategy for Handling Apostrophe's Consistently - PHP, JS, MySQL
country flaguser name
United States
2007-06-09 16:07:42
i prefer storing real data in a php variable, not its html
representation, and make needed conversions at the moment of
output
(use htmlspecialchars when writing to an html document and
mysql_real_escape_string when writing to the database).

concerning the use of single or double quotes i can only say
that you
have to use those that is applicable for your particular
task. check
the corresponding manuals for php / mysql / js to see the
differences
in interpretation. it's a basic knowledge.

--
free web developer tools:
  http://osbtools.goog
lepages.com/


On Jun 8, 4:06 pm, ashore <shor...gmail.com> wrote:
> Folks, given a typical application using all of subject
languages/
> tools, how do you handle apostrophe's consistently?
> That is, given the availability of html entities, JS
escape functions,
> the several php string functions as well as MySQL, I
find myself
> stumbling around on an ad-hoc basis.
>
> Has any of you a decently articulated strategy re when
and where you
> perform needed conversions?
>
> Maybe it all comes down to this:  What do you store in
a MySQL text
> field, the apostrophe character or the html entity? 
And what
> conversion functions do you use?
>
> Thanks, all.
>
> -AS


--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---


Re: Strategy for Handling Apostrophe's Consistently - PHP, JS, MySQL
user name
2007-06-10 17:37:47
I'm gonna fully agree with Stas here. A variable should
store the
data, not some codes.
Thus, if you have $text with strange data, you store it in
DB with
*sql_real_escape_string($text) and output it with
htmlspecialchars($text), put it into URL with
urlencode($text) and so
on. This way you won't have any difficulties.

On 6/10/07, stas <stas.trefilovgmail.com> wrote:
>
> i prefer storing real data in a php variable, not its
html
> representation, and make needed conversions at the
moment of output
> (use htmlspecialchars when writing to an html document
and
> mysql_real_escape_string when writing to the
database).
>
> concerning the use of single or double quotes i can
only say that you
> have to use those that is applicable for your
particular task. check
> the corresponding manuals for php / mysql / js to see
the differences
> in interpretation. it's a basic knowledge.
>
> --
> free web developer tools:
>   http://osbtools.goog
lepages.com/
>
>
> On Jun 8, 4:06 pm, ashore <shor...gmail.com> wrote:
> > Folks, given a typical application using all of
subject languages/
> > tools, how do you handle apostrophe's
consistently?
> > That is, given the availability of html entities,
JS escape functions,
> > the several php string functions as well as MySQL,
I find myself
> > stumbling around on an ad-hoc basis.
> >
> > Has any of you a decently articulated strategy re
when and where you
> > perform needed conversions?
> >
> > Maybe it all comes down to this:  What do you
store in a MySQL text
> > field, the apostrophe character or the html
entity?  And what
> > conversion functions do you use?
> >
> > Thanks, all.
> >
> > -AS
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )