473,322 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

TCP And Character Encoding

Hi,

I am having a real issue with sending data across a network.

I have a string that is composed of the following:

NEW|192.168.0.12|_000000038|_000000001|_000000109| 312886|1|0|_000000001|C|AUTO-ASSIGN|??| ||EN|

I am using the method below to send this string to another systemover tcp that accepts the data over port 5021.

All data is transferred to the other system except the "??". Thisis in hindi or it can be in any other language. The problemarises when the other system receives the data; the "??" isdisplayed as ???. How do i send a string in a diffrent languageover TCP. Your help is appreciated.

public string GetToken(string tosend)
{
try
{
m_socWorker = new Socket(AddressFamily.InterNetwork,SocketType.Strea m, ProtocolType.Tcp);
string szIPSelected = GetIPaddress();
string szPort =System.Configuration.ConfigurationSettings.AppSet tings["RemotePort"];
int alPort = System.Convert.ToInt16(szPort,10);
System.Net.IPAddress remoteIPAddress =System.Net.IPAddress.Parse(szIPSelected);
System.Net.IPEndPoint remoteEndPoint = newSystem.Net.IPEndPoint(remoteIPAddress, alPort);
m_socWorker.Connect(remoteEndPoint);

Object objData = tosend;
byte[] byData =System.Text.Encoding.ASCII.GetBytes(objData.ToStr ing ());
m_socWorker.Send(byData);
}
}
Thanks
--------------------------------
From: Siddharth Sood

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>mpIke1qAK0CsYWPVfplw4A==</Id>
Nov 21 '05 #1
1 1261
System.Text.ASCIIEncoding.ASCII.GetBytes(objData)
Siddharth Sood via .NET 247 wrote:
Hi,

I am having a real issue with sending data across a network.

I have a string that is composed of the following:

NEW|192.168.0.12|_000000038|_000000001|_000000109 |312886|1|0|_000000001|C|AUTO-ASSIGN|??| ||EN|

I am using the method below to send this string to another system over tcp that accepts the data over port 5021.

All data is transferred to the other system except the "??". This is in hindi or it can be in any other language. The problem arises when the other system receives the data; the "??" is displayed as ???. How do i send a string in a diffrent language over TCP. Your help is appreciated.

public string GetToken(string tosend)
{
try
{
m_socWorker = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
string szIPSelected = GetIPaddress();
string szPort = System.Configuration.ConfigurationSettings.AppSett ings["RemotePort"];
int alPort = System.Convert.ToInt16(szPort,10);
System.Net.IPAddress remoteIPAddress = System.Net.IPAddress.Parse(szIPSelected);
System.Net.IPEndPoint remoteEndPoint = new System.Net.IPEndPoint(remoteIPAddress, alPort);
m_socWorker.Connect(remoteEndPoint);

Object objData = tosend;
byte[] byData = System.Text.Encoding.ASCII.GetBytes(objData.ToStri ng ());
m_socWorker.Send(byData);
}
}
Thanks
--------------------------------
From: Siddharth Sood

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>mpIke1qAK0CsYWPVfplw4A==</Id>

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Safalra | last post by:
The idea here is relatively simple: a java program (I'm using JDK1.4 if that makes a difference) that loads an HTML file, removes invalid characters (or replaces them in the case of common ones...
7
by: Mark | last post by:
Hi... I've been doing a lot of work both creating and consuming web services, and I notice there seems to be a discontinuity between a number of the different cogs in the wheel centering around...
6
by: Pavils Jurjans | last post by:
Hello, I am experiencing a weird behaviour on my ASP.NET project. The project consists from client-side, which can be whatever environment - web page, EXE application, etc. The client sends HTTP...
18
by: james | last post by:
Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits the "," and then copies the results into a listbox. The data also...
8
by: Brand Bogard | last post by:
Does the C standard include a library function to convert an 8 bit character string to a 16 bit character string?
37
by: Zhiv Kurilka | last post by:
Hi, I have a text file with following content: "((^)|(.* +))§§§§§§§§" if I read it with: k=System.IO.StreamReader( "file.txt",System.Text.Encoding.ASCII); k.readtotheend()
44
by: Kulgan | last post by:
Hi I am struggling to find definitive information on how IE 5.5, 6 and 7 handle character input (I am happy with the display of text). I have two main questions: 1. Does IE automaticall...
5
by: Timothy Madden | last post by:
Hello Is there a function that will allow me to output text written in utf-8 (from db for example) if my document has Content-Type: text/html; charset=ISO-8859-1 I mean htmlspecialchars()...
17
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, Wide character and multi-byte character are two popular encoding schemes on Windows. And wide character is using unicode encoding scheme. But each time I feel confused when...
10
by: Paul W | last post by:
Hi all, I have an application that reads data in from a text file and stores it in a database. My problem is that there are some characters in the file that aren't being handled properly. For...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.