Web Analytics Made Easy -
StatCounter Use of £ in PHP5.5 - CodingForum

Announcement

Collapse
No announcement yet.

Use of £ in PHP5.5

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Use of £ in PHP5.5

    Hi All,

    I have a script that posts from a form to a MySQL database. My server is running PHP5.5.

    The script is designed to strip out slashes etc when it shows as a confirmation on the page and then posts to the database as follows:

    $title=htmlspecialchars(stripslashes($title),ENT_QUOTES);

    However, the problem we have is that since upgrading from PHP5.2 to PHP5.5 we have not been able to post into the form using the £ symbol. It just disappears on the confirmation page. We can use all other symbols ($ ' " $ % & * etc.), but when the £ symbol is used, it just returns nothing. Can anyone shed some light on what is causing this, and what we need to do to make it work?

    Thanks
    Neil

  • #2
    I am not sure myself but I found this:

    Most improvements in PHP 5.5.x have no impact on existing code. There are a few incompatibilities and new features that should be considered, and code should be tested before switching PHP versions in production environments.
    (Source: PHP: What has changed in PHP 5.5.x - Manual).

    However there area few incompatibilities and it says here:

    Case insensitivity no longer locale specific (That is not your issue but .....)
    This may cause issues for code that uses case insensitive matches for non-ASCII characters in multibyte character sets (including UTF-8), such as accented characters in many European languages. If you have a non-English, non-ASCII code base, then you will need to test that you are not inadvertently relying on this behaviour before deploying PHP 5.5 to production systems.
    (Source:PHP: Backward Incompatible Changes - Manual).

    That might be a good hint ?
    Last edited by clausrei; Sep 29, 2016, 08:33 AM.

    Comment


    • #3
      Originally posted by clausrei View Post
      I am not sure myself but I found this:

      Most improvements in PHP 5.5.x have no impact on existing code. There are a few incompatibilities and new features that should be considered, and code should be tested before switching PHP versions in production environments.
      (Source: PHP: What has changed in PHP 5.5.x - Manual).

      However there area few incompatibilities and it says here:

      Case insensitivity no longer locale specific (That is not your issue but .....)
      This may cause issues for code that uses case insensitive matches for non-ASCII characters in multibyte character sets (including UTF-8), such as accented characters in many European languages. If you have a non-English, non-ASCII code base, then you will need to test that you are not inadvertently relying on this behaviour before deploying PHP 5.5 to production systems.
      (Source:PHP: Backward Incompatible Changes - Manual).

      That might be a good hint ?
      Thanks for replying, but unfortunately not massively helpful. I would have thought that use of £ is a fairly common thing, and that there is a pretty standard fix for it. Like I said in the OP - it works absolutely fine in PHP5.2, but I don't know about later versions of PHP - very strange bug...

      Comment


      • #4
        PHP: htmlspecialchars - Manual
        encoding

        An optional argument defining the encoding used when converting characters.

        If omitted, the default value of the encoding varies depending on the PHP version in use. In PHP 5.6 and later, the default_charset configuration option is used as the default value. PHP 5.4 and 5.5 will use UTF-8 as the default. Earlier versions of PHP use ISO-8859-1.
        try
        PHP Code:
         htmlspecialchars ($string ,ENT_QUOTES "ISO8859-1"); 
        Don't use old mysql library
        The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets
        When a white horse is not a horse

        Comment


        • #5
          Just wondering why you have upgraded to a long dead version of PHP rather than to a current version. Patch support for PHP 5.5 ended a few months ago and it hasn't had full support for years.

          The earliest PHP version still with any support is PHP 5.6. I'd suggest that you upgrade to a currently supported version of PHP and then see if you still have the problem.
          Stephen
          Learn Modern JavaScript - http://javascriptexample.net/
          Helping others to solve their computer problem at http://www.felgall.com/

          Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

          Comment

          Working...
          X