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

Null values in strings - encoding problem?

Hi,

I'm attempting to read some titles and other information from a file that holds information on audio files.

The file follows this format -

TIT2 Name_of_song TPE1 Name_of_album etc.

The problem I am having is that each letter of the song title is followed by a null character, as you can see below:

TIT2\0\0D\0a\0n\0c\0i\0n\0g\0 \0Q\0u\0e\0e\0n\0\0\0\0\0\0\0\0\0

Is there any way to read this in correctly, or do I just have to replace all nulls with String.Empty? I've tried all the different Encoding formats I can, but it seems that nothing works.

Any help is much appreciated.

Steven
Jun 20 '07 #1
3 887
I've never had that problem before. Have you tried splitting the string?
Jun 20 '07 #2
Plater
7,872 Expert 4TB
Is that not 16bit unicode? It looks kinda like it to me, but I don't have a lot of experiance with it.
You have Dancing Queen so the first letter D as bytes would be like 0x00 0x44 (or 0x44 0x00 in reverse byte order)
Which means that the D character is really 0x0044 or 0x4400 if 16bits specify each character.

You could always try reading the file in as bytes and then only looking at every other byte. (Myabe use bitconverter to create a 16bit int then cast it as a char?)
Jun 20 '07 #3
Thanks for your suggestion. However, the file looks as though it has two encodings in it, possibly - if it was 16bit unicode, would the 'TIT2' at the start not read '\0T\0I\0T\02' ? Or have I got the wrong end of the stick?

I am at the moment using substring to get the string between the two tags and then replace the '\0' with an empty string, which does seem to work. Maybe I'll stick with that unless anyone has any other ideas?
Jun 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Barry | last post by:
Hi all! I support a rather large production EDI application with a number of C programs, and I ran across a very interesting problem. I have some code that used to work just fine for years, and...
4
by: kyl | last post by:
A Java Axis consumed by .Net C# client, it built and executed the WS method from the WSDL gotten from OK, the response object is NULL. Is there any more thing more should be done on Java server?
7
by: Danny Tuppeny | last post by:
Hi All, I've been going through Google Groups, but nothing seems to quite match my problem. It's hard to post a WSDL or anything at the moment (it's not my service, I'm just using it), but maybe...
0
by: Algobardo | last post by:
Good morning, this is the first time i write on this forum because i googled and i've seen related post with no solution. I will expose briefly the problem. I'm using c# 3.5 and i'm trying using...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.