text encoding to gb2312

I get message by shell ( ls -l dir)
and as the result is “gbk or gb2312” and shows garbled.
dim x as string = me.ReadAll
dim y as string = x.ConvertEncoding(SystemDefault) is no affort for me.
Window1.TextArea1.Text =y// or nShell.result

Use DefineEncoding instead of ConvertEncoding.

sorry ,i try defineencoding,but nothing changes.
dim x as string = me.ReadAll
//dim y as string = x.ConvertEncoding(Encodings.SystemDefault )
//dim z as string = y.ConvertEncoding(encodings.UTF8)
dim xx as string
xx= DefineEncoding ( x,encodings.DOSChineseSimpl)
Window1.TextArea1.Text =xx // or nShell.result

my system is win7/chinese simple language

Have a look at the data in the debugger. Is the data UTF8 or UTF16 encoded? Is the result fully garbled or can you recognize some of the result?

dont by “xojo”,
I use command shell to print "dir " no garbeld.
use command shell to print "ls " has garbeld.

and so the reason is command "ls " itself garbeld first. however ,can see the "ls " 's encode,but from debugger of xojo,
the origin decode is “&h400”

so in my app, i change to
x =DefineEncoding(x,encodings.DOSLatinUS) is not ok

howerver, I can use “Dir” instead and ok.

You are difficult to understand.

Which system are you using ?

You refer to ls which is Linux/Unix, and to Dir, which is Windows. If you try to use ls in Windows, it will not work.

Can you please post your real code. Make sure to click on the 7th icon on the right before, so it looks nice and legible.

sorry I have installed cygwin before.so I can use ls command…

Could you please post your code, and if possible, a screen shot ?

pls find the forum lsShell.zip or lsShell.

and I just running on my computer



OK. Can you please post a screen shot of the “garbled” result you are getting ?

don’t know how to paste a picture…

I used “dir” and everything is ok now.

what confuse me is “ls” in windows cmd window is “garbled”.

you could produce it without xojo.

just using simple command line.(dos window)

Place the picture on Dropbox. The thing is, your project seems to be OK. As the word “garbled”, it can mean anything, so seeing what is exactly there would help.

It is an hypothesis, but I suspect CygWin maybe simply using an encoding that is not compatible with CP1252 which is used by the Xojo shell under Windows.

If for instance you have a Chinese Windows, it is possible that it generates UTF-16 which will be OK with the Command Prompt, but not understood by Xojo shell. This happened before with other users. The Chinese Windows Command prompt is able to display ideographs in names and that cannot work with Xojo shell.

yes,so I consider “dir” is ok,and it solved.
and for cygwin’s “ls”, i think it generate a unknow coding files ,so that we can’t simple use xojo to convert.

thanks michel