Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7541509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:54:42+00:00 2026-05-30T07:54:42+00:00

I am facing a tiny issue (I believe) in socket programming. When sending text

  • 0

I am facing a tiny issue (I believe) in socket programming. When sending text from non-English languages, I get garbled results. After a lot of researching on google, I made some corrections. I changed getBytes() to getBytes("UTF-8") and tried to send some Arabic text.

When connecting sockets locally, it works fine. I see the arabic text I expected. But when testing from online, the results display strange/garbled characters.

Here is the text I tried:

“مرحبا” (this is the arab text of “hello”) which displayed to me as “مرحبا”

Please help me in resolving this issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:54:44+00:00Added an answer on May 30, 2026 at 7:54 am

    This is some Java code I had lying around that’s used for setting the stream encodings on a pair of byte streams, but you could do the same with a singleton, at least assuming you’re using TCP stream sockets not UDP datagrams.

        Process
        slave_process = Runtime.getRuntime().exec("cmdname -opts cmdargs");
    
     OutputStream
     __bytes_into_his_stdin  = slave_process.getOutputStream();
    
     OutputStreamWriter
       chars_into_his_stdin  = new OutputStreamWriter(
                                 __bytes_into_his_stdin,
             /* DO NOT OMIT! */  Charset.forName("UTF-8").newEncoder()
                             );
    
     InputStream
     __bytes_from_his_stdout = slave_process.getInputStream();
    
     InputStreamReader
       chars_from_his_stdout = new InputStreamReader(
                                 __bytes_from_his_stdout,
             /* DO NOT OMIT! */  Charset.forName("UTF-8").newDecoder()
                             );
    
     InputStream
     __bytes_from_his_stderr = slave_process.getErrorStream();
    
     InputStreamReader
       chars_from_his_stderr = new InputStreamReader(
                                 __bytes_from_his_stderr,
             /* DO NOT OMIT! */  Charset.forName("UTF-8").newDecoder()
                             );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im facing an issue which I believe to be VAO-dependant, but Im not sure..
Im facing a strange issue trying to move from sql server to oracle. in
I'm facing a problem to get return value (content-type: text/xml). I'm able to get
I am facing an issue in my application with tiny mce. All the gem
I'm facing a problem with IE6. I took the toggle function from this website
I am facing strange issue on Windows CE: Running 3 EXEs 1)First exe doing
I am facing a strange issue after the popup is created onclick . The
Im facing a bit of an issue when trying to validate a decimal property
we are facing a strange issue. we have a (custom)file upload control in our
I just come from my tiny nice JavaSE/Guice world and am currently discovering the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.