Menu

#30 Error reading Chinese MP3 Tag

open
nobody
None
5
2003-05-05
2003-05-05
No

1) I replaced the function readTag with the function
below. Since asian characters are all double byted. Fix
byte length doesn’t work for double byte characters.

private void readTag(RandomAccessFile raf)

throws FileNotFoundException, IOException {

raf.seek(raf.length() - TAG_SIZE);

byte[] buf = new byte[TAG_SIZE];

raf.read(buf, 0, TAG_SIZE);

String tag = new String(buf, 0, TAG_SIZE);

int start = TAG_START.length();

// title = chopSubstring(tag, start, start +=
TITLE_SIZE);

// artist = chopSubstring(tag, start, start +=
ARTIST_SIZE);

// album = chopSubstring(tag, start, start +=
ALBUM_SIZE);

// year = chopSubstring(tag, start, start +=
YEAR_SIZE);

// comment = chopSubstring(tag, start, start +=
COMMENT_SIZE);

StringTokenizer tokenizer = new StringTokenizer
(tag);

title = tokenizer.nextToken(String.valueOf('\0'));

artist = tokenizer.nextToken(String.valueOf('\0'));

album = tokenizer.nextToken(String.valueOf('\0'));

year = tokenizer.nextToken(String.valueOf('\0'));

comment = tokenizer.nextToken(String.valueOf
('\0'));

track = (int) (buf[TRACK_LOCATION] &
0xff); //reed - access genre ids > 127

genre = (int) (buf[GENRE_LOCATION] & 0xff);

}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.