AW: Possible automatic encoding of characters when inserting them using mysqli statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jacob,

it seems the variables are urlencoded, %2F would be urlencoded a forward
slash. If that's the case, these two functions should help you decode the
variables:

urldecode: http://php.net/manual/en/function.urldecode.php
rawurldecode: http://php.net/manual/en/function.rawurldecode.php

I've encountered some problems where percent prefixed strings were not
decoded correctly / completely when using urldecode, you may have to try a
bit if urldecode or rawurldecode will suit you better.

Let me know if you need help!

Cheers and have a nice weekend,

Sascha

-----Ursprüngliche Nachricht-----
Von: Jacob Kruger [mailto:jacob@xxxxxxxxxxxxx] 
Gesendet: Samstag, 13. Juni 2015 00:10
An: php-windows@xxxxxxxxxxxxx
Betreff:  Possible automatic encoding of characters when inserting
them using mysqli statements

I am working on my own version of a relatively simplistic CMS, and when, for
example, I insert the relative path to an image into the mysql 5.0 database,
it's, for example, converting/encoding the / character into %2F.

This is handled using prepared mysqli statements, and passing the values
through as bound parameter values.

Now I can easily enough do a str_ireplace() function call on the value when
then retrieving it, before rendering it for output, but, would prefer to
avoid specifically doing a search/replace on a few specific character
values, just in case there's something that haven't noticed as of yet that
might cause a further issue later on.

In other words, am trying to remember what the relevant function would be to
call to handle the conversion of the encoded character back to the original
one at run time?

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet..."


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux