Skip to content

Commit 216c894

Browse files
authored
fix(hubble): encode/decode Chinese error after building package (#627)
1 parent d048802 commit 216c894

File tree

7 files changed

+11
-2
lines changed

7 files changed

+11
-2
lines changed

hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/HugeGraphHubble.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
2828
import org.springframework.scheduling.annotation.EnableScheduling;
2929

30+
import java.nio.charset.Charset;
31+
import java.nio.charset.StandardCharsets;
32+
3033
@SpringBootApplication
3134
@EnableScheduling
3235
@MapperScan("org.apache.hugegraph.mapper")
@@ -38,6 +41,8 @@ public static void main(String[] args) {
3841
}
3942

4043
public static void initEnv() {
44+
Ex.check(Charset.defaultCharset().equals(StandardCharsets.UTF_8),
45+
"Charset must be UTF-8, current:" + Charset.defaultCharset());
4146
String hubbleHomePath = System.getProperty("hubble.home.path");
4247
Ex.check(StringUtils.isNotEmpty(hubbleHomePath),
4348
"The system property 'hubble.home.path' must be set");

hugegraph-hubble/hubble-dist/assembly/static/bin/start-hubble.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ for jar in "${LIB_PATH}"/*.jar; do
4242
class_path=${class_path}:${jar}
4343
done
4444

45-
JAVA_OPTS="-Xms512m"
45+
JAVA_OPTS="-Xms512m -Dfile.encoding=UTF-8"
4646
JAVA_DEBUG_OPTS=""
4747
FOREGROUND="false"
4848

hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# License for the specific language governing permissions and limitations
1616
# under the License.
1717
#
18+
export LANG=zh_CN.UTF-8
1819
set -ev
1920

2021
if [[ $# -ne 1 ]]; then

hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph-hubble.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
export LANG=zh_CN.UTF-8
1819
set -ev
1920

2021
TRAVIS_DIR=$(dirname "$0")

hugegraph-hubble/hubble-dist/assembly/travis/install-hugegraph.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
export LANG=zh_CN.UTF-8
1819
set -ev
1920

2021
COMMIT_ID=$1

hugegraph-hubble/hubble-dist/assembly/travis/run-api-test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
export LANG=zh_CN.UTF-8
1819
set -ev
1920

2021
TRAVIS_DIR="hubble-dist/assembly/travis"

hugegraph-hubble/hubble-dist/assembly/travis/start-hubble.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ args=${CONF_PATH}/hugegraph-hubble.properties
8080
log=${LOG_PATH}/hugegraph-hubble.log
8181

8282
echo -n "starting HugeGraphHubble "
83-
nohup nice -n 0 java -server "${java_opts}" "${agent_opts}" -Dhubble.home.path="${HOME_PATH}" -cp "${class_path}" ${main_class} "${args}" > "${log}" 2>&1 < /dev/null &
83+
nohup nice -n 0 java -server -Dfile.encoding=UTF-8 "${java_opts}" "${agent_opts}" -Dhubble.home.path="${HOME_PATH}" -cp "${class_path}" ${main_class} "${args}" > "${log}" 2>&1 < /dev/null &
8484
pid=$!
8585
echo ${pid} > "${PID_FILE}"
8686

0 commit comments

Comments
 (0)