Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder student's Avatar
    Join Date
    Jan 2007
    Posts
    129
    Thanks
    13
    Thanked 0 Times in 0 Posts

    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.

  • #2
    New Coder
    Join Date
    Nov 2008
    Posts
    59
    Thanks
    5
    Thanked 4 Times in 4 Posts
    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).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •