Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-22-2008, 01:51 PM   PM User | #1
student
Regular Coder

 
student's Avatar
 
Join Date: Jan 2007
Posts: 129
Thanks: 13
Thanked 0 Times in 0 Posts
student is an unknown quantity at this point
Arrow how to send text using form post method when it has special characters

Hello,
I have some text files and they have many special characters.
I need to read the text in each file using
$handle = @fopen($filename, "r")
....
fread($handle, 1024000);
....
$content=urlencode($content);
...

Then, I am sending this to a form using post method using CURL.

Every file that doesn't have special characters is getting submitted without any problem.
However, when there are some special characters like


®
©

The form is not getting submitted.

I have tried to use this code :
$search = array("‘", "’", "'", "—", "”", "“", "…", "™", "®", "©");
$content = str_replace($search, "", $content);

But there are many more symbols and characters as i open new files.

So, please help me deal with these special characters.

Or, I think I need to encode these special characters into UTF-8
Please inform me how to do it.

Thank you.

Last edited by student; 11-22-2008 at 02:13 PM..
student is offline   Reply With Quote
Old 11-22-2008, 04:45 PM   PM User | #2
scrappy
New Coder

 
Join Date: Nov 2008
Posts: 59
Thanks: 5
Thanked 4 Times in 4 Posts
scrappy is an unknown quantity at this point
Quote:
I think I need to encode these special characters into UTF-8
Please inform me how to do it.
string utf8_encode ( string $data ) ? Although I would encode the form encoding engine to be suitable, or rawurlencode() if your doing it yourself.

I don't know what your using CURL for, but I prefer to use XMLHttpRequest via Javascript, which is built into many web browsers (except IE6 and earlier, in which you have to use ActiveX). This way I can dynamically update the form as the user sees it (They got the main part of the page, followed shortly by the other parts).
scrappy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:56 AM.


Advertisement
Log in to turn off these ads.