Encoding/decoding A Variable
Is there a function that will temporarily encode a variable (say, for passing through a URL), and another that would decode the same?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Encoding / Decoding Multi Dimensional Session Array
Can you encode and decode multi-dimensional arrays? I think encoding them works just fine using session_encode(), however, session_decode is only capable of decoding the single dimensional arrays stored in the encoded string...
UTF-8 Not Decoding
I am opening a stream that is UTF encoded. I use fgetc to read the stream- which is binary safe. I add every character read to a string. But when I look at the stream, I see some characters with a bunch of "?" question markets, and then utf8_decode has no effect on it either. How do you go about decoding utf. Does adding the characters to the string somehow mess it up. Please help. Running 4.3.4 PHP on Win.
String Decoding
I am taking in a list of serial numbers using a text area and passing it to my DBController. I have the list of serials seperated using a semicolon(;). I have been trying a couple of different methods for decoding the string into seperate serials but would appreciate any ideas on the topic.
Decoding Mail
I have evaluated the mime_parser (by M. Lemos) and one of the suggested scripts listed as comments on the php.net imap_fetchstructure page (spam at emielmols dot info,1-Apr 2005) to try and extract the body parts from a message that has an attached message. Basically it is a plain text message that is a reply to a prior message. The prior message is within the body of the main message as a RFC822 subtype. The script on the imap_fetchstructure page seems to concatenate the new message with the reply instead of separating them. Mime_parser just puts the entire message being replied to (the attachment) as a text string, with all headers . . . Does anyone have suggestions of a script to separately pull out the body parts and headers from the message and the included message?
Decoding MySQL SET Value
I'm trying to figure out what to do once I get the SET value from a SELECT of a SET column in MySQL. Is there anyway to deconstruct it to determine which values were chosen? For example, if the SET values are 1, 2, 4, 8, 16, and the value I get back is 18, how can I programatically determine that 16 and 2 were chosen?
Decoding Bin2hex
Shat im trying to do is unpack some bin2hex data from an xml document and print it into a phpnuke block and i need to be able to apply html formatting to it. The document being: http://www.pbbans.com/sigs/142.xml The printing part works fine, but I can't seem to get a hex2bin function to unpack the data properly. I've tried quite a few things, this being the latest: ....
Email Header Decoding
I've got a problem with decoding e-mail message subject, which has been read within usage of Pear_Mail_Mime library. There are some elements unwelcome in my subject string, such as: =?ISO-8859-2?Q?My subject. Especially when subject contains polish characters, i.e.: =?ISO-8859-2?Q?Temat listu, bardzo wa=BFny, gdy=BF zawi=EAr=B1 p=F3l=B6ki=EA =BF=F1=B1ki, = What is the easiest method of decoding it into the UTF-8 encoding? Probably it is a common problem, so where can I find a solution for it?
URL Parameter En-Decoding Problem
I've got a Javascript-PHP encoding problem. (1) Here is the short version: ============================== I'm sending a form textfield via Javascript(!) as URL parameter (GET) from one php-page to another and want to send all possible special characters like !"§$%&/()=?#öäÜ and so on to the target page. On the target page I read the URL-parameter via PHP and use it parameter as input for a MySQL LIKE command within a SELECT command. My problem: Special Characters are not decoded properly! I encoding on the source file with Javascript and encoding on the target side via PHP but found no way to make it work. (2) Here is the detailed version: ================================= I have a php-file "alphasuche_Auswahlmaske.php". In this php-file I have a form with one textfield named "name". The entry in this textfield is used for a search in a MySQL Database. When the "submit"-button is pressed the entered value is passed to another php-file named "alphasuche.php" where the entered value is used for a Database search with the MySQL LIKE- command. Here is the Javascript(!)-command which sends the entered value to the "alphasuche.php" file: --begin-- <script type="text/JavaScript"> // The typical Macromedia Dreamweaver "Go To URL"-command function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); } .... // This part sends the "name" form textfield MM_goToURL('parent','alphasuche.php? name='+document.form1.name.value+'&plz='+document.form1.plz.value); .... </script> --end--
Decoding Base64 Into An Image
I am trying to take the data from an xml file that is base64 encoded image and view it. I have a code snippet that will take the data and save it to a file. The file can be viewed as a jpg in a picture viewer but cannot be viewed in a web browser. I would rather have it do both, save to a file for tracking purposes and be displayable in a web browser because this will be sent to a third person to print out in their email. Code:
Decoding Html Chars For FCKeditor
I am trying to extract data that was placed in my DB by FCKeditor. I am using this to put into the WYSIWYG editor screen. The content in the DB looks like this:
Decoding The Query String Array
I am building a very simple form that takes text and inserts data in a MySQL db. I would like my "logic" to simply insert the value in to the field in the database that matches the name from the query string. Here's the question- can I do this if I do not know how many name/value pairs are passed to the "logic" ? Can I just step through the $_POST array and use a do while $i <= count($_POST) or something? I have tried this but for some reason I cannot get a number back from the $_POST array. I am also confused about how the $_POST array is constructed. How do I reference name/value pair $_POST[0,1,2 etc...] get their "names" and "values" in to variables so I can accomplish the INSERT SQL(e.g. $name = $_POST[0,0]; $value = $_POST[0,1]; [INSERT $value INTO $name];- The MySQL fields will match $name)?
Reading And Decoding Email Attachments
i want to write a PHP4 script that reads POP3 or IMAP mail and can decode the possible attachments in the email. I've looked around for some classes to do this, and found a few, but most of them seem to be very lowlevel or lacking in functionality. Is there a good script, class or example for decoding email attachments? I have used a class called attachmentread, but this class expects an attachment as disposition: attachment, while my email with attachments are all inline...
Application/x-pkcs7-mime Decoding Class?
Does anyone know about any php classes to decode emails which are s/mime encrypted? they contain no body and other mime parts, only a file smime.p7m, with mime type application/x-pkcs7-mime, disposition inline. I can download the file from imap with no problem, ...
Decoding Ranking System Of Google News
I want to decode the ranking system of google news, what is their algorithm? What factors they consider in ranking news? what the weightage of each factor? etc
Stop Xml Parser From Decoding Special Characters
Question -- the xml parser appears to automatically convert special html-encoded characters in xml ( such as ' and > ) to their character equivalents -- & and >. I need to store these characters in their encoded form, so this is a problem for me. Rather than slap htmlspecialchar() onto every element call in the script (which is both ugly and inefficient), what else can I do?
URL Encoding
In one of my PHP applications, I generate a dynamic link to another page. The parameter list contains a few variables with some special characters, so as expected, I use urlencode() to encode the parameters before plopping them into the URL. For some strange reason, the link doesn't work - I get a "page cannot be displayed" error in IE 6. NS 6 starts to load it, then just stops. Oddly enough, if I go into the location bar (under IE at least), and delete one (1) character, any character from this one particular parameter (search_expr), the page loads fine (albeit with a messed up parameter). Code:
URL Encoding
Can anyone point me in the direction of a tutorial on URL encoding? I am creating a website and i want to use 1 page which contains the layout, then seperate pages with the content. i would do it something similar to this: http://website.com/index.php?page=links Then that would just call up a .inc page specified in the page= variable and display it on index.php.
Php Encoding
i was wondering, which is a good-freeware php enconding alternative? Im running the apache server on a windows platform.
Encoding
I have a problem. How can I transform this xml: $xml="<name>Niccolò</name>" to this $xml="<name>Niccolò</name>" I recive by CURL from a site this xml: <?xml version="1.0"> <name>Niccolò</name> but, for some reasons, I want: <?xml version="1.0"> <name>Niccolò</name>
Which Encoding?
Not really a PHP question, but i've got an app that sends me this type of encoding: á (á) translates to %C3%A1 ñ (ñ) translates to %C3%B1 i've tried several decodings with PHP without any good result. Anyone knows which type of encoding is this and which function to use in order to decode it with PHP?
Encoding
my website is parsing 4 external xml files (rss feeds) and writes them in a mysql database. my problem is that 2 of the xml files are encoded in utf-8 and 2 of them are windows 1250. when i need to retrieve the data from the database and display it on my site (which is utf-8) i have a problem with special characters that are encoded in windows 1250. I need all the data in my database to be encoded in one way. how to do that ? or is there another way?
Help On Character Encoding
I have a string in windows-1256 character set. But i would like to change from this chracter set to utf-8. (actually it is for to display arabic text). I am using in my whole site utf-8. Any help highly appreciated.
Chinese Encoding
I have a forum mainly in Chinese character. There are some characters which cannot be shown correctly and turn into "& #22175" ... does anyone know how to fix this?
Email Encoding
I'm using the code below to send emails right now. Its is secure?
Low-end PHP Encoding For Windows
FYI, BadBlue added a built-in PHP encoding capability to the enterprise version of their Windows web server. The personal edition of the server is a free download and is a quick easy way to get PHP running: http://badblue.com/helpphps.htm .
Encoding Problem
I have a dom tree representing the content of a html document. In the xml I use € as the euro sign. I think I need to do this to be able to use xsl transformations. After the xsl transformation I use a small SAX parser. But my € gets converted to: â,¬50. I've tried passing xml_parser_create() 'UTF-8' and '' (hint from php.net) but it only makes things worse ( ? or squares are displayed ). How do i have to encode characters to be able to pass them to SAX. Is there a build in function or do I use str_replace()? Replace tld with top level domain of belgium to contact me pgp:0x3B7D6BD6 The soul would have no rainbow had the eyes no tears.
GB2312 Encoding In PHP
I have language text stored as variables in text files, which are 'included' by my PHP scripts (is there a better way?). However, I seem to have a problem with the simplified chinese GB2312 encoding format. I thought that most foreign encoding mechanisms would avoid the use of the quotation mark - however, I saved something out as GB2312 and now effectively get parse errors (due to premature quotes which appear to form parts of the Chinese characters themselves). A few other websites I tested though don't seem to have a problem sending me mail in GB2312 though ... so they must have somehow managed.
Locale And Different Encoding
I have a simple question about locale and PHP5. I'm using polish characters but I encode them in UTF-8. I was sorting an array with usort($array, 'strcoll'); but I've entred a problem. I was sorting arrays this way: setlocale(LC_ALL, 'pl_PL.utf8'); usort($array, 'strcoll'); but it turned out to be completely wrong... I've started to test various encodings on various OS and ended with this sample PHP script that sorts UTF-8 encoded array on both Linux and Windows with locale encoding set to ISO-8859-2: <? // file encoding is UTF-8 $array = array('Aea', 'Eaz', 'Eaz', 'Eaz', 'Aea', 'Aeas'); var_dump(mb_detect_encoding($array[1])); // shows UTF-8 - OK // set locale encoding ISO-8859-2 // pl_PL for Linux // polish_Poland.28592 for Windows if (PHP_OS == 'WINNT') { setlocale(LC_ALL, 'polish_Poland.28592'); } else { setlocale(LC_ALL, 'pl_PL'); } // sort usort($array, 'strcoll'); // works OK on both Linux and Windows var_dump($array); ?> how come it works on both Linux Gentoo PHP 5.1.1 and Windows NT PHP 5.1.4? the contents of $array contents are encoded in UTF-8, but encoding is set to ISO-8859-2 (via setlocale)
Php Script Encoding
this is my first "topic" on Google Groups. I'm looking for a solution for 4 days, without results. So... my apache is serving pages in UTF-8 but my php scripts are writed (I'm speaking about strings) in ISO-8859-1. How can I say at apache how to interpret my scripts in a different charset? I don't want to change every "è" with "è" I think that it should be a simple configuration in the .conf or in the ..ini but... nothig found about.
SoapVar And Encoding
what's going on with the following (I'm working in non-WSDL mode). Basically, I need the following in the SOAP request body: <ns6:create> ... <property> <name>Property 1</name> <value>Test Value 1</value> </property> <property> <name>Property 2</name> <value>Test Value 2</value> </property> </ns6:create> So I've created a class called Create that has the required members, and stores the property elements (which are instances of a class called NamedValue) in an array: class NamedValue { public $name; public $value; public function __construct($name, $value) { ... } } class Create { public $id; public $parent; public $type; public $property; public function __construct(...) { ... $property = array( new NamedValue("Property 1", "Test Value 1"), new NamedValue("Property 2", "Test Value 2") ); } }
Euc-kr Encoding Problem
I have a dom tree representing the content of a html document. I use character-set as the euc-kr sign. Can I use a <?xml encoding="euc-kr" ?> This source don't work. How Can I use character-set as the euc-kr ?
Character Encoding In PHP & GD2?
I have been working on a dynamic image in GD2 which acts as a chatbox in a forum signature. It all seems to be working pretty well, but I have come across a bug (of sorts): if the user were to enter characters such as '¬_¬' the result in the image is shown as 'Ž_Ž'. Is there any way that, using PHP, I can change this so that is actually understands the characters and would print '¬_¬'.?
Character Encoding
I'm working on a site for my brothers friend and it has a commentary system. The commentaries get added by calling a Javascript which updates the current page and then call a PHP script to store the comment in a mySQL database. My problem is at if the user uses any kind of special chars like the danish chars: æ, ø and å then the PHP script will just die on them. It will store the message until the chars and then stop. I've tried running an escape () in the javascript on the txt i'm sending, and i've tried using CONVERT ('string' USING utf8) in the SQL query. The entire site is encoded in UTF-8, and so is the database but the user might type in ISO-8859-1 (?). Somewhere else on the site i have a fileupload, here the page calls the upload script directly and it has no problems storing special chars in the database, so i'm thinking the problem might be a combination of the Javascript and PHP. I'm hoping someone has an idea to what might be wrong. Code:
Detect Character Encoding?
My Problem is I want to build my own small web interface. works fine with imap_ functions so far. But now i got problems with Mails coming from MS Outlook - they are UTF-7 or UTF-8 encoded. I don't know how to find out how they are encoded? Second Problem: Got a character Sequence in the subject looking like that: Ihre Anfrage: =?iso-8859-1?Q?minpoll=20timelimit=20wie=20gro=DF=3F?= Don't know what to do with that. Perhaps someone could drop some info on encoding.
Character Encoding Issues
I have built a CMS for a client. They client is copy pasting characters from Microsoft Word into the CMS and saving. When the CMS content is later displayed, several of the characters are shown as wier junk characters like: — or ’. I fixed this at one level by converting the MySQL database to UTF8. This fixed it insofar as my computer is now diaplaying those characters properly but apparently some other computers are not. Some other computers are still showing wierd characters. Does anyone know what the problem thus might still be? Are some client machines missing the fontmaps to express those characters? Or, are they not understanding to display that text as UTF8 perhaps?
SOAP And Accept-Encoding
I'm trying to make a SOAP request, and enable compression in the response (by sending the Accept-Encoding header). To do this, I'm sending 'compression' =SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP in the SoapClient constructor's options. But when I print the request headers, I don't see the Accept-Encoding header. Am I doing something wrong? I also tried SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9 to set the compression level, as I've seen in some examples. I just downloaded and compiled php 5.2.1 with --enable-soap on Mac OS 10.4.9. The full example is below: $o_client = new SoapClient($wsdlURL, array( 'trace' =true, 'compression' =SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'login' =$login, 'password' =$password )); $o_result = $o_client->acknowledge(); echo $o_client->__getLastRequestHeaders();
Zend Optimizer Encoding
I'm currently running into problems with Zend Optimized PHP code; or more clear, a partner of mine asked me to adapt a script he bought which is encoded this way. Does anyone know if this can be done, or if there are any projects trying to develop a free decoder/decompiler? I know this might be a bit off-topic here, but I couldn't find a list that seemed to fit better to me.
Domxml_new_doc - Can I Add Encoding Attribute?
I've got a question about adding encoding attribute to my DOM XML Document? I'm from Poland and we use extended latin alphabet - I'd like to use iso-8859-2 Polish charset e.g.: <?xml version="1.0" encoding="iso-8859-2"?> is there such posibility in DOM XML?
Send Request With Encoding
Does anyone know if it allows to send request with specific encoding? What i want to do is sending japanese as a parameter. But always gives me an error "Invalid protocol " $http_request = new Snoopy; $str = mb_convert_encoding($this -mAddress,"UTF-8", "Shift_JIS"); $url = "http://www.myusite.jp/api/?v=1.1&q='"+$str+"'"; $http_request -fetch( $url ); if( !$http_request -error ){ }
Encoding Problem, Can't Solve It
Text I get: # stat¸ pakeitimai # em s paskirties keitimas As you can see some letters isn't exactly as it should be. It's in UTF-8 in MySQL (utf8_lithuanian_ci) and I transfer using utf8 encoding. The problem I need those letters, I think those should be called latin. But where they are gone I can't image.
Flex Form And Encoding
I have a RIA made in Flex whos send data to a PHP Script before I store the data in a database. The function to format my data looks like this:
Character Encoding Issues
When I use utf-8 encoding my page shows up fine. However, if I use iso-8859-1 I get some funky characters that show up at the top of my page where I am just calling "require_once." I am using a Win32/IIS/ISAPI/PHP5 installation, anyone have an idea of what's going on and how to resolve?
Functions' Compatibility For UTF-8 Encoding
I'm writing a system with PHP which encodes with UTF-8 encoding. Everything is encoded with UTF-8 encoding. In order to work with UTF-8 encoded strings, I need to use special functions - mbString function (stands for Multi Byte String), that specially compatible for UTF-8 encoding and others. The problem is that there aren't enough mbString functions so that I will be able to work well with UTF-8 encoded strings. Many important mbString functions are missing. I wrote a list of regular functions and I need to know if they can work well & suitable for UTF-8 encoded strings. Code:
Saved File Encoding
I am querying a database and saving the results as a tab-delimited file. Is there a way to force the saved file to open in a certain encoding such as ISO Latin 1? Also, what is the best way to deal with carriage returns in the data I am saving?
Character Encoding And Rewrite?
im having a real problem with character encoding and php i aware that php has some problems with character encoding but i dont really understand them whats got me even more stumped is that when i was developing the same thing on my pc i never had this problem im now on a mac whats more the problem only seems to happen when using the rewrite rule in the htaccess? basically if i have an file index.html and it is <?php echo "£"; ?> it echos a £ sign fine if however i use an htaccess file to redirect any request to another file lets say invoke.html and it has the same thing it outputs £ i know for this example i should just echo £ but this isnt exactly what im trying to do this is just the simpliest example of the problem what im actually doing is fopen fread a file then using strpos to find any £ symbols the £ symbols in the file are just £ symbols if i echo the read file contents they output as just £ symbols however if i put "£" in as the needle for strpos it goes in as £ and therefore doesnt find it in the haystack.
Encoding Necessary To Send The TM Symbol Via Mail()?
Anybody know what encoding is necessary to send text containing the TM symbol via mail()? The html is " & t r a d e ; " or " & # 1 5 3 ; " and email source has the character encoded as " = 8 1 " I am on a macintosh so the tm symbol is [option + 2] but when i code this it displays as a superscript "a" in the email. Does anybody have any suggestions?
Fopen GB2312 Encoding Problem
I am trying to read in a url which is encoded in GB2312 (http:// top.baidu.com/winkvane.html). I have tried other pages with this encoding and each time I get a connection time out error. It seems that fopen cannot open a webpage in GB2312. Is there a way around this? Has anyone else had this sort of problem? Here is an example with some simple code (using PHP5): $file = fopen("http://top.baidu.com/winkvane.html", "r") or exit("Unable to open file!"); while(!feof($file)) { echo fgets($file). "<br />"; } fclose($file);
Encoding Problem - Parsing An Xml File
I have a problem while parsing an xml file. The file is a backup from moodle (moodle.xml). When i open the file with one of my editors and setting Encoding to utf8 font courier standard or greek characters the editor can see all greek strings contained within the file perfectly. On the other hand when i try to open it with php parse it and then display it on a web page the data from the file come out like latin characters like (A~ atilde)(o: o umplaud) and others like this. Updating moodle is not an option so i have to find a workaround. Has anybody heard of something like this?
|