[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Google Translate API's
hi Scott,
thanks, I will look forward to this enhancement.
It is correct that the original RFC documents specified a URL
to be escaped in US-ASCII, but that was before the world got
globalized, by the way Firefox 3.0 encodes AJAX call's in UTF-8
as standard.
Apparently Google expects UTF-8 encoding, and I don't think it
is the last we have seen of that, so it would be great to have
this feature.
Regards
Henrik
Scott Klement <sk@xxxxxxxxxxxxxxxx>
Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
29-07-2009 21:04
Please respond to
HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
To
HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
cc
Subject
Re: Google Translate API's
hi Henrik,
Sorry, I've been responding slowly to your messages because I'm very
busy.
You've discovered most of the problem already, but let me explain it
from my point of view. The following three points are central to the
way it currently works:
1) URL-encoded data is intended to be data that is valid in an HTTP
URL.
2) Since an HTTP URL is part of the HTTP protocol, the encoded data
should be in the protocol's encoding (CCSID).
3) The RFC documents that set the standard for the HTTP protocol state
that HTTP uses 7-bit US-ASCII encoding for the protocol itself.
You seem to be asking HTTPAPI to convert your data from EBCDIC to
UTF-8,
then URL encode the UTF-8 data into 7-bit US-ASCII. In other words,
first convert it to a variable-byte character set, and then encode it
as
a single byte character set for the purposes of making it compliant
with
the 7-bit ASCII in a URL, then convert it back to EBCDIC, so you can
add
it to your URL and have HTTPAPI convert it back to ASCII again when
sending the request.
WHEW! Can you see how confusing this gets?
Anyway... I think I can do that easily enough. I'll treat the input
to
the URL encoder as being in the CCSID of the PostData (so the existing
HTTP_setCCSIDs routine will work) and then translate it to whichever
CCSID you've specified, then encode it, then translate back to EBCDIC
as
if the data had been ASCII. Complicated, but it should work.
I have a (beta) fix already on my machine. Unfortunately, I'm in the
midst of reworking all of the EXAMPLExx members in HTTPAPI (since a
lot
of them are useless or outdated and no longer work) and that makes it
difficult for me to put together a beta copy for you to test.
So please be patient.
hr@xxxxxxxxxxxx wrote:
> Hi Scott,
> I think I found the problem.
> In CCSID 1208 any character expressed
> in numeric >128 (x'7F') is 2 to 6 bytes
> long but in ENCODERR4 it is treated as a
> one byte long field.
> Because Google Translate is a "modern"
> API meant for AJAX calls it requires
> URL's that is js-encodeURIComponent
> (UTF-8) encoded instead of js-escaped
> (ISO-8859-1)
> Regards
> Henrik
>
>
>
>
----------------------------------------------------------------------
--
>
>
----------------------------------------------------------------------
-
> This is the FTPAPI mailing list. To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
>
----------------------------------------------------------------------
-
----------------------------------------------------------------------
-
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
----------------------------------------------------------------------
-
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------