Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Using international characters in forms
Old 04-21-2006, 11:26 AM Using international characters in forms
bureX's Avatar
Novice Talker

Posts: 8
Trades: 0
Here is the example HTML code I am using:

HTML Code:
<form id="form1" name="form1" method="post" action="">
  <p>
Submit everything here:
    <input name="text" type="text" id="text" />  
    <input type="submit" name="Submit" value="Submit" />
  </p>
And here is the example PHP code (located on the same page):
PHP Code:
<?php
echo($_POST['text']);
?>
As you can see, I'm simply using this form to accept text input, and when clicking "Submit", the page refreshes and outputs the POST data.

And now, here's the problem... When typing a word using international characters (e.g. ﺮﺫﺾﺻﺹﺶﻊ <-- I have no idea what that means, btw), I get this outputted to my browser: ﺮﺫﺾﺻﺹﺶﻊ. Yes, it's the exact same thing, but if I take a closer look inside the HTML code, I can see that these letters look like this:
Code:
& #65198;& #65195;& #65214;& #65211;& #65209;& #65206;& #65226;
(Edit: THERE ARE NO SPACES BETWEEN & and #, the forum keeps parsing these codes into arabic characters, and that's why I had to split them)

What should I do when I want to use these characters for something else? E.g. put them inside a MySQL database? I don't want them to be in this form! How do I convert them back to their original form? Any ideas?

PS: Tried fiddling around with the chr() and ord() functions, but I would rather take a look if there are any simpler ways to solve this!
__________________

Please login or register to view this content. Registration is FREE
- My humble homecooked blog (with extra salt)

Last edited by bureX; 04-21-2006 at 01:31 PM..
bureX is offline
Reply With Quote
View Public Profile Visit bureX's homepage!
 
 
Register now for full access!
Old 04-21-2006, 12:24 PM Re: Using international characters in forms
cdwhalley.com's Avatar
Skilled Talker

Posts: 75
Trades: 0
I really don't get the problem.
Take a look at the string functions - maybe you will find something helpful?
cdwhalley.com is offline
Reply With Quote
View Public Profile Visit cdwhalley.com's homepage!
 
Old 04-21-2006, 01:40 PM Re: Using international characters in forms
bureX's Avatar
Novice Talker

Posts: 8
Trades: 0
****... Sorry for the confusion... The forum parsed some codes into arabic characters...

Here's the bottom line:
I get these characters delivered to my PHP script in this form:
& #65198;& #65195;& #65214;& #65211;& #65209;& #65206;& #65226;


But I want them to be in this form - ﺮﺫﺾﺻﺹﺶﻊ so that I can store them inside a mySQL database. I will also export these values into a TXT file, so I cannot let my PHP script write something like this into it:

Hello, your name is & #65198;& #65195;& #65214;& #65211;& #65209;& #65206;& #65226; !

Instead, I want it to look like this:
Hello, your name is ﺮﺫﺾﺻﺹﺶﻊ

Now do you get it?


Good...
After doing some searching, I think I have found what I need: html_entity_decode()
This function does just what I want!
__________________

Please login or register to view this content. Registration is FREE
- My humble homecooked blog (with extra salt)
bureX is offline
Reply With Quote
View Public Profile Visit bureX's homepage!
 
Old 04-21-2006, 03:40 PM Re: Using international characters in forms
cdwhalley.com's Avatar
Skilled Talker

Posts: 75
Trades: 0
But if you save the : ﺮ& #65195;& #65214;& #65211;& #65209;& #65206;& #65226; into the database and then output it as 'Hello, name!', it will still appear on the screen back as the characters.

It won't come up as: Hello, your name is & #65198;& #65195;& #65214;& #65211;& #65209;& #65206;& #65226; ! because if it did, you wouldn't have 'had this outputted to my browser: ﺮﺫﺾﺻﺹﺶﻊ' in the first place.

Those characters will always be in their ISO number codes 'behind the scenes', but they will always be put back again by the browser as the proper characters.

Last edited by cdwhalley.com; 04-21-2006 at 03:41 PM..
cdwhalley.com is offline
Reply With Quote
View Public Profile Visit cdwhalley.com's homepage!
 
Reply     « Reply to Using international characters in forms
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19441 seconds with 12 queries