[fpc-pascal] Re: RE : JSON and UTF8
reinierolislagers at gmail.com
Thu Jul 12 11:02:10 CEST 2012
On 11-7-2012 22:22, waldo kitty wrote:
> On 7/11/2012 01:36, Reinier Olislagers wrote:
>> On 11-7-2012 4:19, waldo kitty wrote:
>>> On 7/10/2012 07:00, Luiz Americo Pereira Camara wrote:
>>>> With the old behavior, in an system with a system code page<> UTF8,
>>>> if i try to
>>>> show the parsed value of "\u4E01" in e.g. a LCL app will get garbage.
>>>> I would expect to work correctly in any enviroment
>>> this means that some environments will end up with "garbage" for those
>>> UTF-8 characters that cannot be translated back to the local codepage...
>> And your point is?
> that there will be data loss when converting from UTF-8 to codepages
> with less characters than UTF-8 has... that is what i stated and i
> thought it was an answer to the poster's question/problem of conversion...
> maybe we're talking the same basic point to each other? ;)
Could be, but I had the feeling you failed to see the advantage of not
doing an unicode=>codepage conversion inside the FPJSON code if you
don't want codepage output.
Actually, it was me who had trouble with the original setup of FPJSON
discarding information because it did the unicode=>codepage conversion
regardless. I wanted to get UTF8 and could never get that.
My solution was to modify (a tiny bit) and fork FPJSON for my
twitter/OAuth v1 library.
To my pleasant surprise, Luiz Americo posted bug 22310 based on that and
fortunately Michael Van Canneyt adapted fpjson so I can use it for e.g.
my twitter code... and retire the fork once FPC trunk has been released
as stable and is widely available (solved it now with a conditional unit
So thanks to Luiz & Michael, and as always comments/patches welcome:
... or new applications based on this; oauthv1 is apparently also used
by Yahoo and other providers...
Leledumbo on the forum has e.g. written an application for plurk.com
with the library:
... and he said he intended to adapt it for use with Facebook sometime...
More information about the fpc-pascal