how to check which text encoding is used using php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ptrckgorman
Forum Newbie
Posts: 1
Joined: Fri Dec 26, 2008 11:55 am

how to check which text encoding is used using php

Post by ptrckgorman »

Dear all,
i have a text file which contain some text in a encoded format. how to decode the text and how to check which encoding is used for that text.

the text in my text file is in the from
text = 050003000302004A0048004A004D004A006B006A0047004A0 04D004A0048004A004D004A0047004A004D0047004A004D00 4A0047004A0047004A004D004A004E004A0047004A004D004 A0047004A004D006A0067006A00610067004D004A0047004A 006A006D006A002E002C0027003F00210022002D002800290 040002F003A005F003B002B00260025002A
is there any way to decode it to a normal text message
watson516
Forum Contributor
Posts: 198
Joined: Mon Mar 20, 2006 9:19 pm
Location: Hamilton, Ontario

Re: how to check which text encoding is used using php

Post by watson516 »

Have you tryed mb_detect_encoding? This seems to check the encoding of a file.
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: how to check which text encoding is used using php

Post by Mark Baker »

watson516 wrote:Have you tryed mb_detect_encoding?
mb_detect_encoding() isn't particularly useful, because it can return a lot of false positives.

Nor does the listed sample text appear to be any standard encoding for web pages.
It looks more like a set of hex values, most of which correspond to ASCII control characters.

To try and identify the coding, we need a lot more informationabout the file, what generated it, is it numeric or text data, etc.
Post Reply