For Android music player musicians, albums, music names display garbled changes made under summary:
Method One: Modify in Frameworks\base\media\java\android\media\mediascanner.java: function Handlestringtag
In this function, the conversion of character encoding is added;
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" >/*add by Tanfusheng @20150110 start * /Private Boolean isencoding (String value,string code) throws Unsupportedenc odingexception{ return Value.equals (New String (Value.getbytes (code), code)); } /*add by Tanfusheng @20150110 end * /public void Handlestringtag (string name, String value) { /*add by Tanfusheng @20150110 Start */ try{ if (isencoding (value, "iso-8859-1")) { value = new String (Value.getbytes (" Iso-8859-1 ")," GBK "); } } catch (Unsupportedencodingexception e) { e.printstacktrace (); } /*add by Tanfusheng @20150110 End */</span>
Can be
Method Two: Modify in Frameworks\av\media\libmedia\mediascannerclient.cpp:
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" >void Mediascannerclient::endfile () {if (mlocaleencoding! = kencodingnone) {int size = Mnames->size (); + int count = 0 ; uint32_t encoding = kencodingall;uint32_t tmpencoding = kencodingall;uint32_t srcencoding = kencodingnone;for (int i = 0; I < mnames->size (); i++) {tmpencoding = Possibleencodings (Mvalues->getentry (i));//If No multibyte encoding is detected or GBK are the only Possible multibyte encoding, just ignore-if ((kencodingnone! = tmpencoding) && (kEncodingCP1252! = tmpencoding)- && ((KENCODINGGBK | kEncodingCP1252)! = tmpencoding)) {-Encoding &= tmpencoding;+ if (kencodingnone = = Tmpe ncoding) | | ((KENCODINGGBK | kEncodingCP1252) = = tmpencoding)) {+ continue;} + + if (kEncodingCP1252 = = tmpencoding) {+ ++count;+ continue;+}++ encoding &= tmpencoding; LOGV ("Value:%s, tmpencoding:%x\n", Mvalues->getentry (i), tmpencoding);} + + if (count >= 2) {+ encoding = kencodingall;+}LOGV ("Possibleencodings:%x\n ", encoding); ...} </span>where the + sign represents the code to be added, the-number represents the code to be deleted.
Hope to encounter this garbled problem can be used, if this change will also garbled, that is the single-head music problem, you have to use thousands of listening to modify the music encoding method, as for the method can Baidu to.
Android Music garbled problem modification