How To Handle Special Characters In RSS Generated By PHP?
I generate RSS 2.0 using PHP from mysql DB, for example:
echo "<title>" . $title . </title>";
echo "<link>" . $link . </link>";
echo "<description>" . $description . "</description>">
The problem is, sometime there are special characters in $description or $title, for example, trademark symbol. Is there a function which can remove these characters? I tried to use htmlspecialchars ($description), which only work with HTML tags.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Handle Special Characters Like Ü,Ä Etc In Php
I am passing company name entered by the user on our site to a system command. But whenever a user enter's some special char like Ü or É then the command fails. I want to know how to handle these character's while passing them to a system command. I am using Exec() of php. any help is appreciated.
Auto-generated Password - Which Characters Do You Disallow
When you autogenerate passwords, which characters do you keep out of your passwords? The obvious are 0 - zero O - oh (upper case) 1 - one l - el (lower case) and perhaps o - oh (lower case) Any others that lead to confusion and users writing to say they keep entering their passwords, but they can't log in?
Need Help With Special Characters
A simple form that asks a player Nick, a Quake 3 Nick Where: ^1 = Red ^4= Blue, etc. Through ^1 to ^8 you get the colors. For example: ^4<LGG>^2Ozzman Will display: <LGG>Ozzman The problem is that special characters causes errors or I can't echo the variables correctly. < and > is a TAG for PHP so it disapear when I echo the $nick var. And what about the ^ or other special characters? How Can I do this?
Special Characters
I'm writting a news management script and I have run into a problem. When some submits a news artical it sometime contain special characters that might now show up on all browsers. Is there a way to makeit check for the characters and switch them to html that can be read by browsers. Is there a way to do this and name it as like, filter.inc then just tell the program to just use this inc file before sending the content to the database. I want to be able to use the special character to html lib for other programs.
Special Characters.
When I put in a textarea some french charactes, when I get them back with a SQL request, all is correct. With phpMyAdmin, in the database, I can see this: Et voilà que la star de l'Internet met cette fois la voûte céleste à portée de souris grâce à une nouvelle option baptisée But on another server, with the same PHP code, in the database I have this: Et voilà que la star de l'Internet met cette fois la voûte céleste à portée de souris grâce à une nouvelle optionbaptisée Knowing that the PHP code is the same and the browsers too, which difference in the config files (PHP or MySQL) can affect the characters ?
Special Characters
I'm trying to insert a record into a mySQL database from PHP. The field on the database is of "Blob" type, and the data i'm trying to enter contains a single quote. I'm using this string to enter the data.... PHP Code:
Special Characters
When opening a html file with include() my page does not show special characters, instead it shows something like "?" I've already saw a document about this and I got to the conclusion that is some charset problem... but when reviewing my html code I noticed the following line: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> So I guess it's not this charset problem... or is it? What's wrong?
Special Characters
. _ ! @ # $ ' and space character Hi Guys... nice easy one for you (I hope!). I've got a nice form set up and it's all working fine unless someone enters a special character into the field and then presses submit. Anyway my question is what do you use to prevent special characters in a string interferring with your code? (I know there is a way to do it but don't know what its called which makes searching for it a bit of a pain)?
Displaying Special Characters
My PHP script uses XML SAX functions to extract data from an XML document. In the XML, I have something like: Code: <myelement>Steak & Cheese</myelement> My PHP script extracts the data between the two elements, but when it displays it to the screen, it returns it to HTML as 'Steak & Cheese', but I need it to return 'Steak & Cheese'. Not to be confused with how it looks on the screen to the user. It SHOULD look like 'Steak & Cheese' to the user, but in the page source generated by my script, I want it to be 'Steak & Cheese'.
Problems With Special Characters
I'm not sure whether this is a MySQL or PHP problem, but my best guess is PHP so I'm posting it here. When I retrieve something, using PHP, from my MySQL-database with å,ä or ö in it, it comes out garbled like: "B„ckens G†rd". When I do a "manual" select in the database the special signs seem to be intact. I've never had this problem before, anyone have a clue what the problem could be?
Setcookie And Special Characters
I searched, but couldn't find anything, so I'm asking you guys. I got some strange behavior from setcookie when special characters are involved in a string. example: when you want to write a username posted via form into a cookie and the user types this: [input] It's [/input] and you read the data out of the cookie it comes out like this: [input] It's [/input] A call to stripslashes() won't remove those backslashes, any ideas?
Problem With Special Characters
I'm building a spanish site, and have a line like this: <?php wp_list_pages('title_li=<h2>Paginas</h2>' );?> But in spanish "Paginas" isn't right, it should be "Páginas" instead, in order to read "Páginas". Now, the "á" seems to break the CSS styles, and the fonts from this line is beeing displayed bigger. Do I have a way to display the special character inside that PHP line?
Special Characters (æøå) And Zipfiles
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP, mainly because I need the ability to both create and extract zip-files. I've tried a couple of classes found here and there, and they all seem to have the same problem. I'm currently using PclZip (http://phpconcept.net/pclzip/) but even the simplest one I've tried (zip.lib.php from phpMyAdmin) gives the same result. This is the problem: When I create a zip-file containing any file with special characters in their filenames, the characters gets translated into different special characters. The three characters I myself am having problems with is the Norwegian æ, ø and å (uppercase Æ, Ø and Å), all of which are very common in my language. The zip-file itself can contain these characters without any problems, the only files affected are the ones put into the zip-file. Same happens with directories, obviously. The funny thing is, if I extract a zip-file using the same class, the conversion gets reversed, so the files do end up with the correct names after extraction. This of course means that if I upload a zip-file created using WinZip or any other zip-application, any files with special characters will get translated into completely different characters again. I've made a table showing the converted characters which can be found here: http://akkar.sourceforge.net/zipchars.html Also very strange - I tried making a zip-file containing a zero-length file with the special characters in the filename, and when opening that zip-file in a hex-editor I wasn't able to find the hex values for the converted characters anywhere in the file, but the original filename characters were found at the places where I expected them to be. If someone can help me figure out what's going on I would really appreciate it. I've submitted it as a bug for PclZip but it hasn't gotten any response yet, and since I've seen the same thing happen with other classes I sort of doubt it's only related to PclZip. I've tried it on different servers as well, and with the same result. I've got the impression that PclZip is a popular class for managing zip-files,
Catching Special Characters
I'm have trouble detecting and replacing special characters (specifically Czech-language characters ie š etc) in my php script. What I want the script to do is this: take in a string (posted from a prior form) run through a switch statement that checks each character to see if they are a "special" character, and if so replace it with their html equivalent. So far I have most of them working (specifically AEIOUY with the "acute" accent, both upper case and lower case), but when it comes to the Czech-specific characters above it doesn't detect them. I've tried every notation I can think of, including "x10D" and chr(268) (for the č letter) and nothing seems to work. The string input is a copy/paste from a Word document that already has the special letters encoded (ie I can see them normally in the text box window in my form) into the text box and then posted to my script. I've looked on the php.net manual and didn't find anything of help, and I did look at both the utf8_encode and utf8_decode pages. Though on the utf8_decode page it shows that the character "xc4xb0" is the character 0x130 and can be displayed as "&x#130;" but I don't understand the double "x" encoding ("xc4xb0").
Special Characters (apostrophes, Etc.)
I tried the escaping code in a variety of ways in my script and still no luck. My server is running PHP3 and MySQL 3.22. The only fields where apostrophes will need to be dealt with are the 'name' and 'location1' thru 'location3'. Here is the code from the form generating PHP script for modifying the database: Code:
Special Characters In MySql
I have some special characters in the my MySql data like: É and ç etc. When I use PHP to generate an XML from this database, I get this error: "An invalid character was found in text content. Error processing resource..." My question is, is there any workaround to process the data such that i get a valid XML without this error? or the only option is to remove these characters from the database?
Removing Special Characters
I have a form that has a text box: <input name="weight" type="text" id="weight" size="10" maxlength="5"> When to form is submitted, how do i make it to where the users cannot add any special characters like a comma for instance. This field is for a weight result value, but i need it to be all numeric at result. How can i strip it or make it return an erro on submit. Currently my error system is like so: if($weight == ) { //This is where i want to add the check for special characters// $msg[] = $error7; header("Location: quote_error.php?"); }
Parsing Special Characters
There are so many functions that parse form submissions (is parse the right word?) ... htmlentities() html_entity_decode() get_html_translation_table() htmlspecialchars() nl2br() urlencode(). ... but I want to make sure I cover all my bases. Rather than spend the time trying every combination of these... can someone write out the best way to parse the following... $str = "Testing MySite â„¢ — ‘Site Test’ for Jabbamonkeys Site. He says, “Thanks for the help.†And I say„ Uh-huh. What the special characters, like: Ã Ä Ã…. Click here <a href="www.domain.com"></a> to visit." and make it into... $str = "Testing MySite ™ — ‘Site Test’ for Jabbamonkeys Site. He says, “Thanks for the help.” And I say„ Uh-huh. What the special characters, like: Ã Ä Å. Click here <a href="www.domain.com"></a> to visit." I want it to keep the html formatting (such as the href tag), but change all the special characters. Can someone show me a custom function that does this, or one that already exists?
Special Characters Are Turned Into '?'
I have this script that passes a variable to Google in order to perform a search. The content of the variable comes form an input field in a form: <form name="form" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>" method="get"> <input type="text" name="q" value=" Search"> <input name="Submit" type="submit" value=" Search "> </form> The variables and the code snippet look like this: .....
Forms And Special Characters
I have several PHP webforms that submit information to my MySQL database. However, when a user cuts & pastes from a WORD document, and clicks submit, all of the special characters (i.e. em-dashes) get changed into wierd symbols. Is there some simple line of code that I can use to convert these special symbols into web characters? Or some other simple way to fix this?
$_GET With Special Characters
I have a username, ie. james+@pitt.edu, stored in a database. It goes in fine, and displays properly. It appears correct in the database. However, when I try to display it in a textfield for editing from a $_GET, it comes out something like: james @pitt.edu. Any ideas what could be causing this? So far, I have tried htmlspecialchars and addslashes, but they aren't helping. $str = $_GET['email']; echo $str;
Special Characters In Mysql Query With PHP
I´m using a php-mysql Search engine script called "DGS-Search" and I have a problem with latin characters. For example a query with letter "ä" won´t give any results. When I do the query in Mysql command line, it works fine. I tried to debug the script printing the query to screen and the characters in the query were ok but when the script searches the table nothing is found. So how can I get PHP understand that the letter is really "ö" or "ä" or some else special character.
PHP/Mysql/special Characters Problem
I have an issue with php and/or mysql. I have a php form that writes "items" to a mysql database, including a description of the item. On the mysql server, "magic_quotes_gpc" is ON. I am testing it now by putting special characters in the description field, this is what I am entering: O'Leary "special edition" Now, this item data always gets written to the db just fine and shows up in the db as entered. Seems correct and working just fine up to this point. My problem is with my "edit item" page. This page allows users to update items, including the mentioned "description" field. But when the data is called back up from the db to display in the "edit item" page and the description contains double quotes, the description is cut off, and only shows: O'Leary Here is the code (snippet of the important stuff and numbered) on the "edit item" page: 1. $result = mysql_query("select * from inven where product ='$product'"); 2. $row = mysql_fetch_array($result); 3. echo "Description is: $row[description]"; 4. echo "<table width=80% border=1 cellpadding=4 cellspacing=0>"; 5. ?> 6. <tr><td>Product #:</td><td><input type=text name=product value="<?echo $row[product]?>"></td></tr> 7. <tr><td>Description:</td><td><input type=text name=description value="<?echo $row[description]?>" size=50></td></tr> 8. 9. <? 10. echo "</table>"; 11. echo "<br><br><input type=submit name=Update value=Update>"; 12. ?> The important line of code here is line 6, where the value of description should show. The real value of description that is in the database should be showing up here, but it is cut off if it contains double quotes. Note also that the full value (double quotes and all) of description can be seen in the echo statement at line 3. I'm stumped. To sum up this problem, data appears to get written to the db just fine. The "edit item" page is brought up, but the description - if it contains special characters, is cut off, apparently where there are double quotes. If I go ahead and update the item, the new value in the db is now cut off and not what I want.
Regular Expressions For Special Characters
i'm pretty new to regular expressions and i'm trying to allow the user to enter special characters like !@#$%&()*?"'/-+.^ together with alphanumeric characters and spaces. i've managed to get most of it in except for the + - signs! here's the regexp code: ^[a-zA-Z0-9!@#$\%^&*():;'"/?= ]+$ anyone knows where to integrate the 2 characters in this?
Problems With Apache And Special Characters
Running Apache/2.0.52 on Linux, I've got problems with special characters (Spanish tildes) on my pages. I can see them correctly on my machine (España), but not on my web server (España). My test page is: ------------------------- <html> <h1>España</h1> </html> ------------------------- Within my 'httpd.conf' I set: ------------------- AddDefaultCharset ISO-8859-1 -------------------
Removing Special Characters From A String Using Php?
I have string with special characters like "$%#?,{}*@". I want to remove all these characters , but only if, they precede or is after the string. Eg. Hello?, the question mark after Hello, I need to remove, but say catch?is, here question mark is ok.
Problem With Special Characters After Parsing Xml
I am taking an xml document and turning it into html on a webpage. In the xml document (which is not created by me) there are special characters including (but not limited to) left and right single quotes....
Dealing With Word Special Characters
I have a database that has been populated with content pasted out of MS Word, and is full of special characters -- em dashes, curly quotes, curly apostrophes, etc. Now I'm generating plain text email summaries out of the database and of course those special chars appear as garbage chars in the emails. How can I filter the extracted text and transform these characters into plain text equivalents? Is there a builtin function for this, external class available, or do I need to try and hack it out from scratch?
Switch And Case With Special Characters...
i have a switch and case section. the switch parameter is a veriable called $Char and a character it is (i.e. "e" or any other character (not its ascii value)). how can i put the chars $ " in the case command?
Parsing Out A File Using Special Characters
I am creating a site where someone would enter data into a few text boxes, with the potential for them to be fairly long. I am therefore saving them into a text file instead of a database. With these, there is a potential for someone to use the enter key in these boxes, therefore making it very difficult to just parse it out by line. I am currently trying to figure out how to parse it by special characters (or groups of characters such as "%%$$%%" or something that noone would ever type, on purpose or by accident) I was wondering if there was a way to parse this out by these special characters, or if there was a way to save those line returns that the people enter as something other than a line return.
Stripping Special Characters For Email
I've been given a form that simply takes some user input and relays a message. I've done this a hundred times before, but apparently, I've never taken into account all the special characters. I have tried any number of Google result suggestions to strip out the special characters that are being encoded in a strange way (specifically MS Word chars). Code:
Mcrypt - Encrypting Special Characters
I'm not sure whether this is a known or documented issue (I could'nt turn anything up, but maybe I'm not looking hard enough), but I seem to be have a problem encrypting and decrypting entries with special characters - namely the '@' symbol. For example I can encrypt and decrypt a name or an address - however, if I try this with an email address that contains the '@' symbol, such as: nobody@nobody.com what I get when I decrypt this is: n Just the first letter of the entry. I have been using the GOST cipher, so I'm wondering if it is related to this cipher, or whether there is a problem with special characters in general.
Converting Special Characters Problem With ® And ™
I have a problem with characters such as the ® reg mark it is making an rss feed invalid. I need to convert them to there code when i submit them to a MySQL database but I am not sure of the best way to do this. $text_art = htmlspecialchars($_POST['text_art']); But it does not work.
Mail Headers And Special Characters
I was wondering if someone could help me out with how to include special characters in a mail() header - like the following: $from = "Company, LLC"; //this comma for example will be a problem $fromemail = "someone@somewhere.com"; $subject = "Test"; $message = "Testing..."; $to = "someoneelse@somewhere.com"; mail($to,$subject,$message,"From:$from<$fromemail>"); So in the above example, what could i do to the "$from" variable to ensure that the comma wouldn't break the header?
Addslashes :: Add Special Characters Like An Apostrophy
Hi, I have a question. This script works fine for me except I can't figure out how to allow the user to add special characters like an apostrophy ' on the input form. When a character like that is entered by the user the script doesn't work. I know it has to do with the addslashes function. I tried adding it a couple different ways and I just can't figure out when to add it to get it to work.....
Despite Special Characters Still Prob With Colon And Table
I originally thought my problem was with mysql but now I think it is php related. I'm using this before I put the values from a form in the database $Array[business] = htmlspecialchars($Array[business]); $Array[location] = htmlspecialchars($Array[location]); $Array[postion] = htmlspecialchars($Array[position]); $Array[history] = htmlspecialchars($Array[history]); $Array[goals] = htmlspecialchars($Array[goals]); $Array[relations] = htmlspecialchars($Array[relations]); Most colons go in the table OK. But two colons (from user input) are casuing problems. In two rows only the database thinks the word after one of the colons is another column heading and moves all the data in that row from that point into the next column. Then there ends up being one extra column in the table. I'm wondering why I'm having this problem. I thought the above was supposed to get rid of all problems with special caracters, doesn't it?
Php Retreiving Data From Mssql And Special Characters
not sure if this is the right group for this posting, but i'm don't know where else to post. I've got a simple problem...I have a linux box running apache 2.0 and php5. I'm trying to use the mssql functions in php to retreive data from a mssql server 2k. I'm pulling data from the customers table in the northwind db and i'm getting strange characters instead of special characters. Below is a sample output: (where the quotes are i get a question mark) What I'm getting: ALFKI - Alfreds Futterkiste - Maria Anders ANATR - Ana Trujillo Emparedados y helados - Ana Trujillo ANTON - Antonio Moreno Taquer?a - Antonio Moreno AROUT - Around the Horn - Thomas Hardy BERGS - Berglunds snabbk?p - Christina Berglund What I should get: ALFKI - Alfreds Futterkiste - Maria Anders ANATR - Ana Trujillo Emparedados y helados - Ana Trujillo ANTON - Antonio Moreno Taquería - Antonio Moreno AROUT - Around the Horn - Thomas Hardy BERGS - Berglunds snabbköp - Christina Berglund
Requiring Users To Create PWs With Special Characters? MD5?
I want to create a process to require users to include a "special character" (!@# and such), when creating a password. That in addition to a minimum length. Obviously this is to defeat those trying to create "easily guessable" login pw's. My question is how do I check for the special character if the PW is being MD5 hashed in the PHP? Is parsing/checking the text of the PW before it is hashed a good idea? This seems to be a possible security issue. But it also seems the only way to confirm that their PW fits my requirements.
Reading (and Keeping) Accented And Special Characters
I'm using the php 'file' command to read the contents of an ASCII text file to a variable. The original text file contains some accented and special characters. The problem arises when I echo this variable: the accented characters are messed up. And not only accented characters, for example, the special characters ª is printed as ª. What can I do to correct this issue? I have tried, without success, to use the 'setlocale' command.
Placing Backspace Special Characters In Script
I have a script that outputs data into a .tab file, but for some reason it adds lines before the first row of data, and after the last one. I was wondering if there was a special character (like " " for tab) for backspace or delete? Or can anyone else see a way of getting rid of the lines. I'm using a force download header, to make the browser download the contents of the page, rather than display them.
Convert Special HTML Characters On Include
All I need to do is include the file "menu.html" (the actual menu contents, exported from MS Word - a requirement) in the dailymenu.php template. However, the menu.html file has all sorts of special characters - due to the fact that french, spanish, and itialian food names contain special characters: example: í, è, ó, â, é, ñ, etc. etc. so when I do a simple: <?php include("includes/menu.html"); ?> in the dailymenu.php file, the output is crapped up by the special characters not being converted. Any way you know to include the menu.html file in dailymenu.php template and fix the special characters all at once?
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?
Special Characters In XML Files Parsed With SimpleXML
I got a problem; when using php4 parsing xml files i get special characters displayed good. When using the simpleXML class, the special characters stay. example: ’ shows as ’ insteeds of ' Does anyone know how to fix this?
Checking For Special Characters In A Login /register Script
I have a script to register in order to access a certain part of my site, however I have no clue how to go about stopping people from using!@#$%^&*() ect. in their usernames (passwords are alright) Also i'm not quite sure how to set a minimum limit to the number of characters they have to enter in a field.
Multi-worded $_GET Parameters With Special Characters
I have a site where URLs have parameters in them, and they can be multi-worded (separated by a +) and can also have special characters. So for instance, there's an "Odds & Ends" link that when you click, it sets this: Cat1=Odds+%26+Ends. I need to get that text and transform it back to "Odds & Ends" and stick it in a string variable. This is probably fairly easy but I am a little lost on the best way to do that. What's the best way to transform a $_GET back to a "normal" string? It's important to note that the $_GET could be one word or many and may or may not have the special characters in them.
|