Charsets and Endian-ness

A character set, also known as an “encoding,” is the set of bit patterns used to represent a set of characters. EBCDIC is used in IBM mainframs. ASCII is one of the most popular encoding. Unicode is the third encoding.

Endian-ness refers to the order in memory in which bytes are stored for a multiple byte quantity.

All modern computer architectures are byte-addressable, meaning every byte of main memory has a unique address. If you store multibyte datum in several successive addresses, should the most significant byte (MSB) of the datum go at highest address or the lowest address?

Big Endian, means that the MSB of an integer is stored at the lowest address, and the least significant byte (LSB) at the highest address (The Big End comes first).

0×11223344 is stored as below:

base address+0:0×11
base address+1:0×22
base address+2:0×33
base address+3:0×44

Usage: The APARC, Motorola 68K and the IBM 390 series are all big-endian architecture.

Advantage: telling if a number is +ve or -ve by just looking at the first byte.

 

 

Little Endian, means that the LSB of an integer is stored at the lowest address, and the MSB at the highest address (The Little End comes first).

0×11223344 is stored as below:

base address+0:0×44
base address+1:0×33
base address+2:0×22
base address+3:0×11

Usage: Intel x86 and DEC VAX are all little-endian architecture.

Advantage: telling if a number is odd or even by just looking at the first byte.

Java uses Big-Endian ordering when it processes data, regardless of the platform it is on. Big Endian is also known as “network byte order” because it is used in TCP/IP standard.
The only time endian-ness is an issue when you are trying to read data that was written by a non-java program on PC. Then you have to remember to swap multibyte values on the way in, or swap a buffer around an array.
                                MS Windows      Unix
                                —————————————
Newline                \r\n                    \n
Filename sep      \                   /
Data byte order Little endian         Varies with Hardware
source: Freequestionbank.com

Tags: , , , , ,


Did You Enjoy This Post?

Subscribe to our blog through our RSS feed or email to receive updates on more posts like this.post on your favourite social networking or media site to let others know about this post. Help us generate more buzz by submitting/voting for this post with the following buttons.

Leave a Reply











request new questions/article: send email to freequestionbank at gmail dot com