Skip to content

Commit

Permalink
0.2.4 - utf8 replacing
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickpulver committed Nov 22, 2021
1 parent 30445d7 commit 8754eaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ buildscript {
dependencies {
//…
classpath 'com.appswithlove.loco:loco:0.2.3'
classpath 'com.appswithlove.loco:loco:0.2.4'
}
}
```
Expand Down Expand Up @@ -162,7 +162,7 @@ buildscript {
...
}
dependencies{
classpath 'com.appswithlove.loco:loco:0.2.3'
classpath 'com.appswithlove.loco:loco:0.2.4'
...
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/groovy/com/appswithlove/loco/TaskUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ class TaskUtils {
appendix = "-$lang"
}

// In some rare cases, the encoding parameter in the xml-tag is 'utf8' instead of 'utf-8'.
// todo: if there's a better, more reliable solution to handle this, please submit a PR.
def wrongXmlString = '<?xml version="1.0" encoding="utf8"?>'
if (text.startsWith(wrongXmlString)) {
def expectedXmlString = '<?xml version="1.0" encoding="utf-8"?>'
text = text.replace(wrongXmlString, expectedXmlString)
}

def directory = new File("${locoConfig.resDir}/values$appendix/")
if (!directory.exists()) {
directory.mkdir()
Expand Down

0 comments on commit 8754eaf

Please sign in to comment.