Re: Extra spaces in .XLS files

2016-09-21 Thread Roger Eller
On Wed, Sep 21, 2016 at 9:51 AM, Peter TB Brett 
wrote:

> On 21/09/2016 13:25, Roger Eller wrote:
>
>> Has anyone here ever ran into this?  When I put URL
>> ("file:/path/to/file.xls") into field "imported text", EVERY character has
>> an extra space following it.
>>
>> Example:  c e l l 1 TAB c e l l 2 TAB h e l l o  w o r l d
>>
>> I can script them away to normalize the text, but I find it to be strange.
>>
>
> Hi Roger,
>
> You didn't tell LiveCode how to decode the file, so it's using it's naive
> default decoding strategy (1 byte per character, native encoding) which is
> almost certainly not what you want.
>
> Try something like:
>
> textDecode(url "binfile://path/to/file.xls", "utf-16")
>
> This is also wrong (.xls files are big balls of complicated binary data,
> not text) but it might get you marginally closer.
>
>   Peter
>
> --
> Dr Peter Brett 
> LiveCode Technical Project Manager
>

Thanks Peter!  Had I been working in 8.x that would have done the trick.
You pointed me in the right direction though.

My legacy stack is in 6.x so I had to:

get uniDecode(url ("binfile://path/to/file.xls"))

~Roger
___
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: Extra spaces in .XLS files

2016-09-21 Thread Peter TB Brett

On 21/09/2016 13:25, Roger Eller wrote:

Has anyone here ever ran into this?  When I put URL
("file:/path/to/file.xls") into field "imported text", EVERY character has
an extra space following it.

Example:  c e l l 1 TAB c e l l 2 TAB h e l l o  w o r l d

I can script them away to normalize the text, but I find it to be strange.


Hi Roger,

You didn't tell LiveCode how to decode the file, so it's using it's 
naive default decoding strategy (1 byte per character, native encoding) 
which is almost certainly not what you want.


Try something like:

textDecode(url "binfile://path/to/file.xls", "utf-16")

This is also wrong (.xls files are big balls of complicated binary data, 
not text) but it might get you marginally closer.


  Peter

--
Dr Peter Brett 
LiveCode Technical Project Manager

lcb-mode for Emacs: https://github.com/peter-b/lcb-mode

___
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


Extra spaces in .XLS files

2016-09-21 Thread Roger Eller
Has anyone here ever ran into this?  When I put URL
("file:/path/to/file.xls") into field "imported text", EVERY character has
an extra space following it.

Example:  c e l l 1 TAB c e l l 2 TAB h e l l o  w o r l d

I can script them away to normalize the text, but I find it to be strange.

~Roger
___
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