Re: JSON Safe Text

2015-07-23 Thread Monte Goulding
You really need to know the encoding you are working with. Check if the page 
has a charset attribute first and if it does re-encode to utf8 first. The try 
it in mergJSON. If it chokes then the best you can do is replace any char 
greater than charToNum(127) with “?”. Other than that I think there are 
encoding detectors around but it may depend on how critical the data is...

> On 24 Jul 2015, at 4:03 pm, David Bovill  wrote:
> 
> Yes - it's taken from the wild (an HTML page on the internet). Then turned
> into XML, then a table extracted etc - so looks to me like non-utf8 stuff
> has go in there somewhere.
> 
> That's why I was wandering if there was a way to filter out arbitrary text
> and make it utf8-safe. You know urlencode for utf8 - or plain text? I don't
> want to encode all the spaces and normal / safe chars - just whatever weird
> stuff got into the data?
> 
> On 24 July 2015 at 00:12, Monte Goulding 
> wrote:
> 
>> 
>>> On 24 Jul 2015, at 7:22 am, David Bovill  wrote:
>>> 
>>> I'm placing the text into an array and then using Monte's mergJsonEncode
>>> function to decode it. Usually works fine - but in this case it looks
>> like
>>> the content needs some tidying before I put it into the array.
>> 
>> mergJSON will choke on anything that’s not utf8. Is it possible there’s
>> some other encoded data there or something you are doing with the data is
>> messing with the encoding?
>> 
>> --
>> M E R Goulding 
>> Software development services
>> Bespoke application development for vertical markets
>> 
>> mergExt  - There's an external for that!
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

--
M E R Goulding  
Software development services
Bespoke application development for vertical markets

mergExt  - There's an external for that!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON Safe Text

2015-07-23 Thread David Bovill
Yes - it's taken from the wild (an HTML page on the internet). Then turned
into XML, then a table extracted etc - so looks to me like non-utf8 stuff
has go in there somewhere.

That's why I was wandering if there was a way to filter out arbitrary text
and make it utf8-safe. You know urlencode for utf8 - or plain text? I don't
want to encode all the spaces and normal / safe chars - just whatever weird
stuff got into the data?

On 24 July 2015 at 00:12, Monte Goulding 
wrote:

>
> > On 24 Jul 2015, at 7:22 am, David Bovill  wrote:
> >
> > I'm placing the text into an array and then using Monte's mergJsonEncode
> > function to decode it. Usually works fine - but in this case it looks
> like
> > the content needs some tidying before I put it into the array.
>
> mergJSON will choke on anything that’s not utf8. Is it possible there’s
> some other encoded data there or something you are doing with the data is
> messing with the encoding?
>
> --
> M E R Goulding 
> Software development services
> Bespoke application development for vertical markets
>
> mergExt  - There's an external for that!
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON Safe Text

2015-07-23 Thread Monte Goulding

> On 24 Jul 2015, at 7:22 am, David Bovill  wrote:
> 
> I'm placing the text into an array and then using Monte's mergJsonEncode
> function to decode it. Usually works fine - but in this case it looks like
> the content needs some tidying before I put it into the array.

mergJSON will choke on anything that’s not utf8. Is it possible there’s some 
other encoded data there or something you are doing with the data is messing 
with the encoding?

--
M E R Goulding  
Software development services
Bespoke application development for vertical markets

mergExt  - There's an external for that!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

JSON Safe Text

2015-07-23 Thread David Bovill
Any tricks to ensure that text I receive from an internet (HTML) source -
destined to be placed into a nice pretty JSON wrapper is safe to go? At the
moment it is bugging out somewhere.

I'm placing the text into an array and then using Monte's mergJsonEncode
function to decode it. Usually works fine - but in this case it looks like
the content needs some tidying before I put it into the array.

Hand escaping characters is not really what I want to do - maybe someone
has a function I can use?
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode