Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #17749

Re: Problems with accents

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!news.mb-net.net!open-news-network.org!.POSTED.40.232.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.php
Subject Re: Problems with accents
Date Thu, 17 May 2018 14:31:06 +0200
Organization PointedEars Software (PES)
Lines 55
Message-ID <7455473.HisnY9JQfo@PointedEars.de> (permalink)
References <pdjctl$m7g$1@gioia.aioe.org> <2325308.HWs9MH8kAM@PointedEars.de> <pdjpge$1djt$1@gioia.aioe.org>
Reply-To Thomas 'PointedEars' Lahn <php@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
Injection-Info gwaiyur.mb-net.net; posting-host="40.232.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch:178.197.232.40"; logging-data="22956"; mail-complaints-to="abuse@open-news-network.org"
User-Agent KNode/4.14.2
X-User-ID U2FsdGVkX1+/tNs2OATUvQ34ud+N5Vo0mBNd8IJ9VeFEI3kx1e4QbQ==
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Cancel-Lock sha1:L9Z8DdIQQFbNU1ZRnc0JS17sEVM=
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Xref csiph.com comp.lang.php:17749

Show key headers only | View raw


andre wrote:

> Le 17/05/2018 12:32, Thomas 'PointedEars' Lahn a écrit :
>> But if the value is fixed, in this special case it is easier, and usually
>> better, to use another delimiter both for the PHP string and the HTML
>> attribute value:
>>
>>    echo '<P>INPUT NAME="titre" VALUE="l'homme">';
           ^------------------------------^

This is syntactically incorrect PHP code; should be at least

  echo '<P>INPUT NAME="titre" VALUE="l\'homme">';
  //   ^---------------------------------------^

instead.  [In this way, the PHP-based escaping works because the "attribute" 
value is delimited by <"> (straight quotation mark) instead.]

> The file called from a html form, is a php script generating HTML output.
> so in fact the line is:
> <P>INPUT NAME='titre' VALUE:'$Roww[0]' SIZE=60\n";

No, it is not.

> This to give users the possibility to modify a erroneous entry!

What I said before applies, then.  If the value can be entered this way 
(which AISB I do not think it should), you have to escape the previous, 
*user-provided* value for output in order to prevent code injection such
as cross-site scripting (XSS):

<https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet>

Next time, do not top-post:

<https://www.netmeister.org/news/learn2quote.html>

Also, while your real name is somewhat optional (it is considered polite), 
it is a violation of Internet standards and disregard of Network etiquette 
(Netiquette) to falsify address header fields and use foreign namespaces 
without authorization.  For example, your “pasmoi@pasici.be” is *presently* 
_not_ an e-mail address as *presently* pasici.be is not a registered second-
level domain (but may be in the future):

| Verifying <pasmoi@pasici.be>...
| Mail exchanger(s) for pasici.be: none.
| `A' record for pasici.be: 
| None, thus <pasmoi@pasici.be> is definitely not an e-mail address (no MX).

<http://www.interhack.net/pubs/munging-harmful/>

-- 
PointedEars
Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Problems with accents andre <ahr@blabla.be> - 2018-05-17 10:01 +0200
  Re: Problems with accents Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-05-17 12:32 +0200
    Re: Problems with accents andre <pasmoi@pasici.be> - 2018-05-17 13:36 +0200
      Re: Problems with accents Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-05-17 14:31 +0200
        Re: Problems with accents Jerry Stuckle <jstucklex@attglobal.net> - 2018-05-18 08:50 -0400
      Re: Problems with accents Jerry Stuckle <jstucklex@attglobal.net> - 2018-05-18 08:55 -0400
    Re: Problems with accents Jerry Stuckle <jstucklex@attglobal.net> - 2018-05-18 08:47 -0400
  Re: Problems with accents Richard Yates <richard@yatesguitar.com> - 2018-05-17 05:58 -0700
  Re: solved: Problems with accents andre <pasmoi@pasici.be> - 2018-05-18 17:13 +0200
    Re: solved: Problems with accents Jerry Stuckle <jstucklex@attglobal.net> - 2018-05-18 13:36 -0400
      Re: solved: Problems with accents andre <pasmoi@pasici.be> - 2018-05-19 10:09 +0200
        Re: solved: Problems with accents Jerry Stuckle <jstucklex@attglobal.net> - 2018-05-19 08:48 -0400
        Re: solved: Problems with accents Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-05-19 20:18 +0200
          Re: solved: Problems with accents Jerry Stuckle <jstucklex@attglobal.net> - 2018-05-19 18:33 -0400
            Re: solved: Problems with accents "Peter H. Coffin" <hellsop@ninehells.com> - 2018-05-20 10:44 -0500

csiph-web