473,386 Members | 1,715 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,386 software developers and data experts.

a string that has space between every char!?!?

Hi

Im using MSMQ to send and then read messages. I use a Formatter
(http://support.microsoft.com/default...;EN-US;310683), but I use
"Encoding.Unicode" instead of "Encoding.UTF8".

The problem im having is decode\convert the body of the messages to a
"proper" string.
There are spaces between all chars like: "H I T H E R E" (hi there), does
this have to do with the fact that it's in unicode or is it the StreamReader
that does this.

I really need a "proper" string, no extra spaces. Greatfull for all the help
i can get!!

Best regads
Tobbe

Nov 16 '05 #1
1 2989
Tobbe,

You need to set the encoding on the other end to be Unicode. The reason
you are getting spaces is that those characters are actually being
interpreted as null characters.

On the reader on the other end, make sure you pass an instance of
UnicodeEncoding to the constructor.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Thor-Björn Andersson" <to***@pyramid.se> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
Hi

Im using MSMQ to send and then read messages. I use a Formatter
(http://support.microsoft.com/default...;EN-US;310683), but I use "Encoding.Unicode" instead of "Encoding.UTF8".

The problem im having is decode\convert the body of the messages to a
"proper" string.
There are spaces between all chars like: "H I T H E R E" (hi there), does this have to do with the fact that it's in unicode or is it the StreamReader that does this.

I really need a "proper" string, no extra spaces. Greatfull for all the help i can get!!

Best regads
Tobbe

Nov 16 '05 #2

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

Similar topics

17
by: Olivier Bellemare | last post by:
I've tried to make a function that returns the middle of a string. For example: strmid("this is a text",6,4); would return "is a". Here is my code: char *strmid(char *texte, int depart,...
4
by: Simon Schaap | last post by:
Hello, I have encountered a strange problem and I hope you can help me to understand it. What I want to do is to pass an array of chars to a function that will split it up (on every location where...
1
by: The_Kingpin | last post by:
Hi all, I need to make a function that convert a string into a certain format. Here what are the restriction: -The first letter of the first and last name must be uppercase. -If a first name...
9
by: Durgesh Sharma | last post by:
Hi All, Pleas help me .I am a starter as far as C Language is concerned . How can i Right Trim all the white spaces of a very long (2000 chars) Charecter string ( from the Right Side ) ? or how...
4
by: Locusta | last post by:
Hello, I have been struggeling for replacing a string in a string. The snippet from the program below replaces the <, & and > with the XML equivalent values. In the program, I allocate space...
17
by: Chad Myers | last post by:
I've been perf testing an application of mine and I've noticed that there are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String instances being created. I've done some...
9
by: shyam | last post by:
Hi All Here is a program which basically tokenizes a string based on space seperation. But it does not run bcoz i am directly trying to manuplate the string. I cannot use standard string...
18
by: John | last post by:
Hi, I'm a beginner is using C# and .net. I have big legacy files that stores various values (ints, bytes, strings) and want to read them into a C# programme so that I can store them in a...
11
by: Jacek Dziedzic | last post by:
Hi! I need a routine like: std::string nth_word(const std::string &s, unsigned int n) { // return n-th word from the string, n is 0-based // if 's' contains too few words, return "" //...
6
by: Richard | last post by:
I'm validating a date and time string which must be EXACTLY of the format yy-mm-dd hh:mm:ss and extracting the six numeric values using sscanf. I'm using the format string "%2u-%2u-%2u...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.