Comments (16)
Setting -Dfile.encoding=UTF-8
works. Adding
[compileJava, compileTestJava, compileGroovy, compileTestGroovy]*.options*.encoding = 'UTF-8'
does not work. I'm still a bit unsatisfied as this is something I cannot package witjh the build script and check into our repository easily. Some people use netbeans internal gradle version and not the wrapper and they end up with wrong encoding. I have to package a README and hope that it is read.
Update: I may have found a clue. It seems netbeans/gradle sets the -Dfile.encoding=windows-1252
option if not set manually.
screenshot from taskmanager with cli arguments
Update 2: It's a gradle thing, gradle sets -Dfile.encoding=windows-1252
.
Update 3: Last question remaining would be: Is
[compileJava, compileTestJava, compileGroovy, compileTestGroovy]*.options*.encoding = 'UTF-8'
useless because of -Dfile.encoding
set either manually or by gradle to system default? It always seems to override.
from spock-reports.
Why do you encode your tests as iso-8859-1? It should just work if you switch your tests to utf-8...
But I'll also check if I can find another solution. Stay tuned...
from spock-reports.
The source files are UTF-8, the templates are UTF-8, still the descriptions from the tests still get encoded in ISO-8859-1 which is the system default. Other text from the templates ends up correctly as UTF-8. Therefore the result is a mix-up of UTF-8 and some ISO-8859-1, if interpreted as UTF-8 resulting in ?
characters as placeholders (depending on the editor or interpreter).
from spock-reports.
so, as you use the template report creator, I will use the code from https://github.com/rdmueller/etka15 and try to reproduce the problem...
from spock-reports.
ok. problem reproduced....
from spock-reports.
This is my template (extract), a JIRA template. It's encoded in UTF-8. The line Übersicht
is encoded correct in the result, but the block.text
(block
results from Feature.eachFeature(Closure)
) is not correctly encoded in the result. Block text in the source code (UTF-8 encoded) is:
expect: "Tatsächlicher HTTP-Status-Code entspricht Erwartung"
I could work around if I used: new String(block.text.getBytes('UTF-8'), 'ISO-8859-1')
<%
def stats = utils.stats( data )
%>h2. Bericht für ${data.info.description.className}
h2. Übersicht
...
<%
for ( block in blocks ) {
%>* ${block.kind} ${block.text}
<%
}
%>
...
from spock-reports.
yes, but the workaround is ugly. But I guess, I have a solution. Give me just a moment to verify it. It seems that - alt least in my case - the problem was caused by the encoding of the template file...
from spock-reports.
I am a little puzzled about the workaround: it doesn't work for me with "ß" and "Ü" but with "ä" and "ü"...
and I couldn't verify my solution :-(
from spock-reports.
so, the workaround is OS dependent - for windows it is new String(block.text.getBytes('UTF-8'), 'CP1252')
from spock-reports.
The text you get when you do block.text
comes from Spock's org.spockframework.runtime.model.BlockMetadata#texts()
. I suppose that itself comes from the compiler or Groovy AST Transformer... to enforce UTF-8 and avoid issues, you could try to set the java compiler -encoding
option as explained in the javac documentation or using Gradle, because source code is expected to be in the platform default encoding by default, which in Windows happens to be ISO-8859-1.
from spock-reports.
thanx. I will give it a try...
from spock-reports.
I'll report my results tomorrow. Right now I'am at home and the project in question is out of reach.
from spock-reports.
Renato is right - it's a "problem" with gradle and the os specific file encoding. It can be resolved by setting the environment variable GRADLE_OPTS
to "-Dfile.encoding=UTF-8"
. If you use the windows powershell, this can be done through
$env:GRADLE_OPTS="-Dfile.encoding=UTF-8"
unfortunately, it seems that it can't be set as gradle option, e.g. gradle "-Dfile.encoding=UTF-8" test
verified on my test project
from spock-reports.
I think we can close this Issue now, I posted the last question at the gradle.org forum as it is a more general gradle question.
from spock-reports.
A solution I found: gradle.properties
in the project dir with:
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
works even with daemon, as a new instance is created if the existing one(s) differ from JVM args. That way I can check that file into our subversion/git repository and my collegues don't have to fiddle with the build file.
from spock-reports.
@mfuerstenau glad it works now. Thanks for posting back the solution!
from spock-reports.
Related Issues (20)
- Code blocks are not shown in the Report for Features with @Requires Annotation HOT 6
- Groovy 4 support HOT 5
- The VividAstInspector does not preserve relative indents HOT 2
- Where code blocks are missing their source code HOT 13
- nextSpecExtraInfo() method signature change from 2.2.0-groovy-3.0 HOT 9
- Report is not generated when all class tests have @ignore HOT 7
- Integrate GEB screenshots as part of the Spock-Reports feature HOT 3
- Tests with parameters but without @Unroll will have extraInfo all grouped to first iteration HOT 10
- @Shared Resources that reports extraInfo during the test are throwing exception and info are added to header instead HOT 1
- MalformedJsonException when parallel HOT 1
- Single Page Report HOT 6
- Group and/or exclure tests by annotation HOT 1
- extraInfo is not displayed for tests without data set HOT 7
- Exception on ReportDataAggregator HOT 4
- Error with customized template report creation HOT 7
- Can't set source directory HOT 6
- How it should be configured with `jvm-test-suite` HOT 1
- Temporary solution to embed screenshots and html snapshots into report with GEB and spock-reports HOT 3
- Discussion - how to generate feature file HOT 1
- @Unroll annotation support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spock-reports.