Skip to content

Commit aaaed06

Browse files
committed
Fix encoding issue
1 parent 4211620 commit aaaed06

7 files changed

Lines changed: 33 additions & 5 deletions

File tree

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ RUN mkdir -p /data/trackstudio/upload /data/trackstudio/index \
9595
# Copy WAR built in the builder stage
9696
COPY --from=builder --chown=tomcat:tomcat /app/build/libs/TrackStudio.war $CATALINA_HOME/webapps/
9797

98+
# Set JVM encoding for UTF-8 support
99+
ENV CATALINA_OPTS="-Dfile.encoding=UTF-8"
100+
98101
# Switch to non-root user
99102
USER tomcat
100103

build.gradle.kts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@ tasks.compileJava {
1818
options.encoding = "UTF-8"
1919
}
2020

21+
tasks.compileTestJava {
22+
options.encoding = "UTF-8"
23+
}
24+
25+
tasks.processResources {
26+
filteringCharset = "UTF-8"
27+
// JSTL читает .properties как ISO-8859-1. Конвертируем language_*.properties
28+
// из UTF-8 в ASCII с \uXXXX, как делал Maven (native2ascii),
29+
// чтобы на рантайме текст отображался корректно.
30+
filesMatching("**/language_*.properties") {
31+
filter(org.apache.tools.ant.filters.EscapeUnicode::class.java)
32+
}
33+
}
34+
35+
tasks.processTestResources {
36+
filteringCharset = "UTF-8"
37+
}
38+
2139
repositories {
2240
mavenCentral()
2341
}
@@ -84,4 +102,11 @@ tasks.war {
84102
// Юнит-тесты JUnit4
85103
tasks.test {
86104
useJUnit()
105+
systemProperty("file.encoding", "UTF-8")
106+
}
107+
108+
// Настройка Javadoc для UTF-8 (на случай генерации документации)
109+
tasks.javadoc {
110+
options.encoding = "UTF-8"
111+
(options as StandardJavadocDocletOptions).charSet = "UTF-8"
87112
}

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ services:
4242
depends_on:
4343
- migrator
4444
environment:
45-
CATALINA_OPTS: -Dhibernate.connection.url=${DB_URL} -Dhibernate.connection.username=${DB_USER} -Dhibernate.connection.password=${DB_PASS}
45+
CATALINA_OPTS: -Dfile.encoding=UTF-8 -Dhibernate.connection.url=${DB_URL} -Dhibernate.connection.username=${DB_USER} -Dhibernate.connection.password=${DB_PASS}
4646
volumes:
4747
- tsindex:/data/trackstudio/index
4848
- tsupload:/data/trackstudio/upload

src/main/webapp/WEB-INF/tlds/trackstudiotags.tld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="ISO-8859-1"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE taglib
33
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
44
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">

src/main/webapp/WEB-INF/tlds/x-1_0-rt.tld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="ISO-8859-1" ?>
1+
<?xml version="1.0" encoding="UTF-8" ?>
22
<!DOCTYPE taglib
33
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
44
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">

src/main/webapp/WEB-INF/tlds/x-1_0.tld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="ISO-8859-1" ?>
1+
<?xml version="1.0" encoding="UTF-8" ?>
22
<!DOCTYPE taglib
33
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
44
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">

src/main/webapp/WEB-INF/web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="ISO-8859-1" ?>
1+
<?xml version="1.0" encoding="UTF-8" ?>
22
<web-app
33
xmlns="http://java.sun.com/xml/ns/j2ee"
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

0 commit comments

Comments
 (0)