Loading ...
Sorry, an error occurred while loading the content.

3259Re: [in-phpug] Base64 Encoding

Expand Messages
  • Krishna Shasankar
    Oct 29, 2009
      Hi Murali,

      This is because of a crazy php feature, where it is tryng to parse the
      variable called *$rj9*

      The base64 encoded strings in your email decode as follows

      a2pzJClQMXJqOQ== ---> kjs$)P1$rj9
      a2FzJClQMQ== ---> kas$)P1
      a2FzJClQMSRyajk= ---> kas$)P1$rj9

      $string_WithDoubleQuotes = "kas$)P1$rj9";
      echo base64_encode($string_WithDoubleQuotes);

      *$string_withSingleQuotes = 'kas$)P1$rj9';*
      *echo base64_encode($string_withSingleQuotes);*

      If you use double quotes to store, PHP with to parse any variables inside
      it, so PHPis thinking that $rj9 is available and needs to
      be substituted with its right value(null)
      If you use single quotes your issue can be resolved.

      Krishna Shasankar

      http://www.krishnashasankar.com | http://www.clickoffline.com

      On Thu, Oct 29, 2009 at 8:35 PM, Murali <bmk_srgm@...> wrote:

      > Dear All,
      > I am using the PHP version of 5.2.11. I have problem in Base64 Encoding.
      > For Example
      > $string = "kjs$)P1rj9";
      > echo base64_encode($string);
      > this will return a2pzJClQMXJqOQ== . We have developed the .net
      > application for base64 encoding this will return the same result.
      > But If I assign $string = "kas$)P1$rj9";
      > echo base64_encode($string);
      > this will return a2FzJClQMQ== . But in .net will return a2FzJClQMSRyajk= .
      > based on our spec .net is correct.
      > Can Please help on this how to solve this problem in PHP.
      > Regards
      > Murali
      > [Non-text portions of this message have been removed]

      [Non-text portions of this message have been removed]
    • Show all 5 messages in this topic