Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chinese characters not support #22

Closed
epwtrq opened this issue Jan 15, 2019 · 4 comments
Closed

chinese characters not support #22

epwtrq opened this issue Jan 15, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@epwtrq
Copy link

epwtrq commented Jan 15, 2019

in you demo i insert chinese characters in string.xml then build throw this exception"com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列的字节 2 无效" already add in xml head encoding="utf-8"
thanks !

@BigggFish
Copy link

BigggFish commented Jan 16, 2019

I solved this problem by modifying CopyDependenciesTask.groovy please have a try

 def processValuesResource(String tempFolder) {
        File valuesSourceFile = new File("${tempFolder}/res/values/values.xml")
        File valuesDestFile = new File("${temporaryDir.path}/${variantName}/res/values/values.xml")

        if (valuesSourceFile.exists()) {
            if (!valuesDestFile.exists()) {
                project.copy {
                    from "${tempFolder}/res"
                    include "values/*"
                    into "${temporaryDir.path}/${variantName}/res"
                }
            } else {
                def valuesSource = new XmlSlurper().parse(valuesSourceFile)
                def valuesDest = new XmlSlurper().parse(valuesDestFile)
                valuesSource.children().each {
  
                        valuesDest.appendNode(it)
                    }
                }

                FileOutputStream fileOutputStream = new FileOutputStream(valuesDestFile, false)
                byte[] myBytes = XmlUtil.serialize(valuesDest).getBytes("UTF-8") // !!!修改了这
                fileOutputStream.write(myBytes)
                fileOutputStream.close()
            }
        }
    }

@oscarcpozas
Copy link
Contributor

Hey @BigggFish, thanks for your contribution. Your solution is correct, why don't you give me a pull request?

@oscarcpozas oscarcpozas added the bug Something isn't working label Jan 20, 2019
@oscarcpozas
Copy link
Contributor

#25

@bink-develop
Copy link

this error still occur in my project

Execution failed for task ':module_sdk:copyReleaseDependencies'.

com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。

And I have used the lastest.
classpath "com.mobbeel.plugin:fat-aar:2.0.3"

Could you help me to resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants