Hi folks,
Newbie here and was wondering if anyone could provide me with some assistance. Im using a translation provider API to translate Japanese text I strip from a URL.
In a nutshell I read the Japanese URL find the text I wish to translate and extract it to a variable - stripped of tags and trimmed etc This all works as expected and using UTF-8 I can then display my raw Japanese string fine.
I then need to submit a POST form with the data to the translation service.
If I code a simple HTML page and form similar to :-
<form name="form1" method="post" action="http://myurlgoeshere">
<p>Enter Japanese Text :-
<input type="text" name="jpdata">
<br>
<input type="submit" name="Submit" value="Go">
Then the return is the translation of jpdata from Japanese to English.
However, when I try and embed this into a test PHP script as follows :-
<form name="form1" method="post" action="http://myurlgoeshere">
<input type="hidden" name="<?php echo $jpdata?>">
<br>
<input type="submit" name="Submit" value="Go">
The service Im using for translation appears not to recognise the data I send as it only returns spurious question marks, as if the encoding of the data is incorrect? The only difference being though is instead of the user entering the Japanese text, I ask PHP to echo it into the form.
I do encode the srting to UTF-8 before the data is sent and and I can display the string correctly as Japanese on an HTML/PHP UTF-8 page.
My question is not with regard the service Im using for translation - as I know this works with the HTML version. Is there a functional difference between my HTML version above that works and the PHP version echoing the string into the form? If I view the source of the PHP version it looks correct and the data in the field is correct!
Can anyone shed some light on this or make any suggestions please as its driving me potty 🙂
Many thanks
Ant