B4J Question unicode problem with jshell

behnam_tr

Active Member
Licensed User
Longtime User
I receive a string from C# with jshell, which contains Arabic and Farsi characters, but instead of the original text, only the symbol ??? I receive.
Should I make changes on the c# side or b4j side??

C#:
private void Form1_Load(object sender, EventArgs e)
 {
     Console.WriteLine("این یک متن تستی میباشد"); //not ok
     Console.WriteLine("this is a test text."); //is ok
     Application.Exit();
 }

[CODE lang="b4x" title="b4j code"]
Dim sh1 As Shell
sh1.Initialize("sh1",File.Combine(File.DirApp,ExeFileName),Null)
sh1.WorkingDirectory = File.DirApp
sh1.Run(-1)
Wait For (sh1) sh1_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success And ExitCode = 0 Then
Log("Success")
Log(StdOut) 'print ????????
End If
[/CODE]
 
You could try adding
Code:
Console.OutputEncoding = Encoding.UTF8;
to the c# program.
 
Upvote 1
Solution
You could try adding
Code:
Console.OutputEncoding = Encoding.UTF8;
to the c# program.
Thanks, I have already tested this
It works in the console application
But it does not work in the Windows Form application and gives an error

B4X:
 private void Form1_Load(object sender, EventArgs e)
 {
     Console.OutputEncoding = Encoding.UTF8; //error
      Console.WriteLine("test text....");
 }
[CODE lang="b4x" title="vs2022"]Exception thrown: 'System.IO.IOException' in mscorlib.dll
An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll
The handle is invalid.[/CODE]


At the moment, I have to convert it to a console application. Although there was no need for Windows App in this case
Thankful
 
Last edited:
Upvote 0

Similar Threads

  • Question Question
B4J Question jShell error
Replies
2
Views
3K
  • Question Question
B4J Question JShell Problem
Replies
10
Views
4K
Replies
2
Views
5K
Back
Top