在显示正确的摇篮UTF-8文本 [英] Show UTF-8 text properly in Gradle

查看:101
本文介绍了在显示正确的摇篮UTF-8文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个任务:

task info<<{
    println "Gradle — система автоматической сборки, построенная на принципах Apache Ant и Apache Maven, но предоставляющая DSL на языке Groovy вместо традиционной XML-образной формы представления конфигурации проекта."
}

当我使用commadn

when I use commadn

gradle info -Dfile.encoding=UTF-8

文本没有正确显示。如何解决呢?谢谢你。

The text is not shown properly. How to fix it? Thanks.

推荐答案

的file.encoding 系统属性需要设置权当JVM执行摇篮建设(如在摇篮守护进程)启动。实现这一目标的方法之一是使用出口GRADLE_OPTS = - 指定-Dfile.encoding = UTF-8。可能工作的另一种方法是添加 systemProp.file.encoding = UTF-8 gradle.properties 。当然,这个假设构建脚本文件实际上使用UTF-8编码。要查看你的平台的(因此摇篮的)的默认编码,打印出系统属性的值在构建脚本。

The file.encoding system property needs to be set right when the JVM executing the Gradle build (e.g. the Gradle Daemon) starts up. One way to achieve this is with export GRADLE_OPTS="-Dfile.encoding=utf-8". Another way that might work is to add systemProp.file.encoding=utf-8 to gradle.properties. Of course this assumes that the build script files are actually using utf-8 encoding. To see what your platform's (and therefore Gradle's) default encoding is, print out the system property's value in a build script.

这篇关于在显示正确的摇篮UTF-8文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆