Special Chars on Form to Image (GD), not displaying properly.

Special Chars on Form to Image (GD), not displaying properly.

am 22.02.2006 05:38:19 von louie miranda

------=_Part_713_20317242.1140583099996
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
Content-Disposition: inline

SW0gaGF2aW5nIGEgdHJvdWJsZSBkaXNwbGF5aW5nIHNwZWNpYWwgY2hhcmFj dGVycyBsaWtlICMs
ICsgb24gR0QgKEpwZWcpIC0KSW1hZ2UuIFdoZW4gaSB0eXBlZCBpbiBvbiB0 aGUgZm9ybSArODgg
aXQgb25seSBzaG93cyA4OCBhbmQgdGhlICsgc2lnbiBpcwptaXNzaW5nLgoK TXkgY29kZToKIDw/
cGhwCi4uCiRsaW5lXzFfMSA9IHVybGRlY29kZSgkX0dFVFsibGluZV8xXzEi XSk7Ci4uCi8vIGRp
c3BsYXkgbXkgdGV4dCBmcm9tICRsaW5lXzFfMQppbWFnZXR0ZnRleHQoJGJh Y2tncm91bmQsIDEz
LCAwLCAkbmV3LCA2NSwgJGJsYWNrLAoiaW5jbHVkZXMvcmVzb3VyY2VzLyRm b250cyIsICIkbGlu
ZV8xXzEiKTsKLi4KPz4KCkkgbWFkZSBhIGNvdXBsZSBvZiB0ZXN0cyBhbmQg Zm91bmQgdGhpcyB2
YXJpYWJsZXMuCgogVGhlIGRhdGEgdGhhdCB3aWxsIGJlIHBhc3M6ICs4OGFu ZCMKRGF0YSBmcm9t
IHRoZSB1cmwgKGFkZHJlc3MgYm94KTogJmxpbmVfMV8xPSUyQjg4YW5kJTIz CkltYWdlIGRpc3Bs
YXllZDogODhhbmQgLSBvbmx5IG1pc3NpbmcgKyBhbmQgIwoKV2hhdCBjb3Vs ZCBpIGJlIG1pc3Np
bmc/CgotLQpMb3VpZSBNaXJhbmRhIChsbWlyYW5kYUBnbWFpbC5jb20pCmh0 dHA6Ly93d3cuYXhp
c2hpZnQuY29tCgovL0pTTS1XCg==
------=_Part_713_20317242.1140583099996--

Re: Special Chars on Form to Image (GD), not displaying properly.

am 22.02.2006 06:07:19 von Curt Zirzow

On Wed, Feb 22, 2006 at 12:38:19PM +0800, Louie Miranda wrote:
> Im having a trouble displaying special characters like #, + on GD (Jpeg) -
> Image. When i typed in on the form +88 it only shows 88 and the + sign is
> missing.
>
> My code:
> > ..
> $line_1_1 = urldecode($_GET["line_1_1"]);

You dont want to urldecode() the $_GET vars. PHP already does this
step.

See what happens with:

var_dump(urldecode($_GET['line_1_1']));
var_dump($_GET['line_1_1']);

> ...
> I made a couple of tests and found this variables.
>
> The data that will be pass: +88and#
> Data from the url (address box): &line_1_1=%2B88and%23
> Image displayed: 88and - only missing + and #
>
> What could i be missing?

Well if you dont use the urldecode() as mentioned above, the only
reasons i can think of (assuming + will display properly now):

- The font doesn't have a definition for #
- The area isn't big enough so # is getting truncated.

Curt.
--
cat .signature: No such file or directory

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

Re: Special Chars on Form to Image (GD), not displaying properly.

am 22.02.2006 06:12:00 von louie miranda

------=_Part_1257_20548389.1140585120575
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
Content-Disposition: inline

UGxlYXNlIHJlYWQgYmVsb3cuLgoKPiBJbSBoYXZpbmcgYSB0cm91YmxlIGRp c3BsYXlpbmcgc3Bl
Y2lhbCBjaGFyYWN0ZXJzIGxpa2UgIywgKyBvbiBHRCAoSnBlZykgLQo+ID4g SW1hZ2UuIFdoZW4g
aSB0eXBlZCBpbiBvbiB0aGUgZm9ybSArODggaXQgb25seSBzaG93cyA4OCBh bmQgdGhlICsgc2ln
bgo+IGlzCj4gPiBtaXNzaW5nLgo+ID4KPiA+IE15IGNvZGU6Cj4gPiAgPD9w aHAKPiA+IC4uCj4g
PiAkbGluZV8xXzEgPSB1cmxkZWNvZGUoJF9HRVRbImxpbmVfMV8xIl0pOwo+ Cj4gWW91IGRvbnQg
d2FudCB0byB1cmxkZWNvZGUoKSB0aGUgJF9HRVQgdmFycy4gUEhQIGFsc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wo=
------=_Part_1257_20548389.1140585120575--

Re: Special Chars on Form to Image (GD), not displaying properly.

am 22.02.2006 07:17:53 von Curt Zirzow

On Wed, Feb 22, 2006 at 01:12:00PM +0800, Louie Miranda wrote:
> Please read below..
>
> > Im having a trouble displaying special characters like #, + on GD (Jpeg) -
> > > Image. When i typed in on the form +88 it only shows 88 and the + sign
> > is
> > > missing.
> > >
> > > My code:
> > > > > > ..
> > > $line_1_1 = urldecode($_GET["line_1_1"]);
> >
> > You dont want to urldecode() the $_GET vars. PHP already does this
> > step.
> >
> > See what happens with:
> >
> > var_dump(urldecode($_GET['line_1_1']));
> > var_dump($_GET['line_1_1']);
> >
>
> I tested this not on a GD/Image, but on a plain form and plain var_dump.
> The results:
>
> string(1) " "
> string(1) "+"
>
> So, now if i even make a urldecode it also disappers. I think the problem
> is when i typed in + on the user input via form. The url converts it
> to %2B which
> i think is a space. Because as for my example (seen thru the url):
>
> +88and#
> When displayed on an image becomes..
> 88and
>
> Now, if i made this
>
> +88+and#
> It displays..
> 88 and#

this is where i think your confused, the problem with your original
code is you are ending up urldecoding things twice thus thinking
that %2B == a space.

consider:
echo urlencode(' '); # '+'
echo urlencode('+'); # '%2B'

echo urldecode(' '); # ' '
echo urldecode('+'); # ' '
echo urldecode('%2B'); # '+'

if your url is:
http://server.com/?foo=%2B88an%23

then in php if you do:
echo $_GET['foo'];

you will get '+88and#'

if your url is:
http://server.com/?foo=+88and#

then in php if you do:
echo $_GET['foo'];

you will get: ' 88and'

>
> It converts + to space. Now, how could i filter this properly?

Now given what I said and you have a form defined as:





And you type in the box '+88and#' the url that is submited should
be:
http://server.com/?foo=%2B88and%23

Then:
echo $_GET['foo']; # '+88and#'

Or if you type: ' 88and#' the url should be:

http://server.com/?foo=+88and%23

or possibly (not to confuse things more)

http://server.com/?foo=%2088and%23

Then:
echo $_GET['foo']; # ' 88and#'


Now, the only way that # could seem to disappear is if you have your
form setup like:




And you type: '+88and', The url will look like:
http://server.com/?foo=%2B88and#

thus:
echo $_GET['foo']; # '+88and'

or if you type ' 88and', the url will look like:
http://server.com/?foo=+88and#

thus:
echo $_GET['foo']; # ' 88and'


Curt.
--
cat .signature: No such file or directory

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