Osiris Posted July 7, 2005 Report Share Posted July 7, 2005 Es ņemu datus no adresa līnijas. Kad es ņemu "DVD-RW", tas atgriež to pašu. Bet kad es ņemu "DVD+RW", tas atgriež "DVD RW", t.i. bēz "+". Kāpēc? Būšu ļoti pateicīgs. Link to comment Share on other sites More sharing options...
bubu Posted July 7, 2005 Report Share Posted July 7, 2005 Nepareizi tiek padoti dati skriptam. + zīmi nosūtot tā ir jāsūta hex formā: %2B, tb DVD%2BRW Jo ar + zīmi nokodē atstarpi, tāpēc arī atkodējot tev sanāk tā. Link to comment Share on other sites More sharing options...
Venom Posted July 7, 2005 Report Share Posted July 7, 2005 sk. urlencode() un pretím urldecode() Link to comment Share on other sites More sharing options...
bubu Posted July 7, 2005 Report Share Posted July 7, 2005 Venom, ti cho? kam to urldecode() vajg? tak automātiski viss dekodējas iekš _GET[]. Link to comment Share on other sites More sharing options...
Venom Posted July 7, 2005 Report Share Posted July 7, 2005 kkas ar valodām bija, kad vajadzēja Link to comment Share on other sites More sharing options...
Venom Posted July 7, 2005 Report Share Posted July 7, 2005 ne jau par velti viš tāds uzraxtīts iraid kā funkcija Link to comment Share on other sites More sharing options...
Osiris Posted July 7, 2005 Author Report Share Posted July 7, 2005 (edited) Es, laikām, piekritīšu Bubu, jo tie dati (iekš adreses ($_GET)) man iet no citas lpp, bet pirms tām no DB. Tur pat (DB) arī iekodēšu pareizi. Sakiet man lūdzu, ja es domaju nepareizi. Papildināts: Bet kāpēc "-" ir, bet "+" nav ? Edited July 7, 2005 by Osiris Link to comment Share on other sites More sharing options...
bubu Posted July 7, 2005 Report Share Posted July 7, 2005 lai nokodētu urlī visādus kreisos simbolus (&, aststarpes, unicodes), tad tos kodē hexā %HEX, taču, lai ietaupītu vietu, tad atstarpes kodē uz +, tas iznāk īsāk. Link to comment Share on other sites More sharing options...
Osiris Posted July 7, 2005 Author Report Share Posted July 7, 2005 bubu, bet kāpēc "-" atspoguļojas? Tāpēc, kā vertējas kā defise? Link to comment Share on other sites More sharing options...
bubu Posted July 7, 2005 Report Share Posted July 7, 2005 (edited) Tāpēc, ka - ir normāls simbols! Iz http://www.rfc-editor.org/rfc/rfc1738.txt : Thus, only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL. In addition, octets may be encoded by a character triplet consisting of the character "%" followed by the two hexadecimal digits (from "0123456789ABCDEF") which forming the hexadecimal value of the octet. (The characters "abcdef" may also be used in hexadecimal encodings.) par tiem reserved characters priekš HTTP urļa: http://<host>:<port>/<path>?<searchpart>... Within the <path> and <searchpart> components, "/", ";", "?" are reserved. The "/" character may be used within HTTP to designate a hierarchical structure. Edited July 7, 2005 by bubu Link to comment Share on other sites More sharing options...
Osiris Posted July 7, 2005 Author Report Share Posted July 7, 2005 ...the special characters "$-_.+!*'(),"... "+" (pluss) taču ir iekļauts ! Link to comment Share on other sites More sharing options...
bubu Posted July 7, 2005 Report Share Posted July 7, 2005 (edited) Tieši tāpēc viņs tiek lietots urlī. Tu nesaprati būtību. + ir atļauts urlī, atstarpe nav. Tātad astarpi nokodēsim par + urlis "DVD RW" (nederīgs urlis) tiek nokodēts par "DVD+RW" (derīgs urlis) Pēc saņemšanas urli vajag atkodēt. "DVD+RW" atkodējas par "DVD RW". Viss ok. Taču, ja vajag mums padod + zīmi kā tādu tad vajag padod urli "DVD%2BRW", tas atkodēsies par "DVD+RW". Atkodēšanās notiek vienmēr, vai tev ir lietoti % zīmes vai nē. Edited July 7, 2005 by bubu Link to comment Share on other sites More sharing options...
Venom Posted July 7, 2005 Report Share Posted July 7, 2005 plusam būs savs %34 vai k-kas tml. + tiek reti izmantots, bet - drīkst arī domēnvārdos Link to comment Share on other sites More sharing options...
Osiris Posted July 7, 2005 Author Report Share Posted July 7, 2005 (edited) tad sanāk ka es domāju: DEFISE :) Paldies visiem! Edited July 7, 2005 by Osiris Link to comment Share on other sites More sharing options...
Recommended Posts