Android Music garbled problem modification

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.