Skip to content

Commit 9f4c877

Browse files
authored
Merge pull request #65 from Maia-Everett/unicode
Fix Unicode output (#64)
2 parents dccb761 + af3b944 commit 9f4c877

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

compiler/base/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ RUN /playground/attach_notice.sh /playground/security_notice.txt /etc/passwd &&
4141
COPY --chown=playground --from=dependencies target/dependency /playground/dependencies
4242
COPY --chown=playground --from=jre jre /playground/jre
4343

44+
# Install locale for proper Unicode support
45+
RUN apt-get update && \
46+
apt-get -y install locales && \
47+
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
48+
locale-gen
49+
ENV LANG en_US.UTF-8
50+
4451
USER playground
4552
ENV USER=playground
4653
ENV PATH=/playground/jre/bin:$PATH

ui/src/sandbox.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,28 @@ mod test {
679679
assert!(resp.stdout.contains("Hello, world!"));
680680
}
681681

682+
#[tokio::test]
683+
async fn unicode() {
684+
let _singleton = one_test_at_a_time();
685+
let code = r#"
686+
public class Main {
687+
public static void main(String[] args) {
688+
System.out.println("Привет, мир!");
689+
}
690+
}
691+
"#;
692+
693+
let req = ExecuteRequest {
694+
code: code.to_string(),
695+
..ExecuteRequest::default()
696+
};
697+
698+
let sb = Sandbox::new().await.expect("Unable to create sandbox");
699+
let resp = sb.execute(&req).await.expect("Unable to execute code");
700+
701+
assert!(resp.stdout.contains("Привет, мир!"));
702+
}
703+
682704
#[tokio::test]
683705
async fn network_connections_are_disabled() {
684706
let _singleton = one_test_at_a_time();

0 commit comments

Comments
 (0)