Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this text UTF-16?

Status
Not open for further replies.

bene223

Programmer
Joined
Aug 18, 2003
Messages
2
Location
US
I'm writing a program in Perl on Windows XP that involves reading the contents of a binary file into an array separated by 1 byte. There is a string that I'm specifically looking for in the file that reads 'AAAAA'. I've found the location of the string, however the hex value of the string is as follows:

41 00 41 00 41 00 41 00 41 00

My guess is that the string is in UTF-16 format but I'm not sure. Can someone lead me in the right direction as to how I would translate this to an ASCII string?
 
This might do it:

Code:
use Encode;
print decode('UTF16LE',$string);

Are you certain that it's 41 00 41 00 and not 00 41 00 41? If it's the latter you may need to use UTF16BE.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top