diff --git a/samples/pi/src/main/webapp/wasm.html b/samples/pi/src/main/webapp/wasm.html
index 29601f787..f7cf5480a 100644
--- a/samples/pi/src/main/webapp/wasm.html
+++ b/samples/pi/src/main/webapp/wasm.html
@@ -37,8 +37,9 @@
let memory = new Int8Array(instance.exports.memory.buffer);
let string = "";
for (let i = 0; i < count; ++i) {
- string += $rt_putStdoutCustom(memory[address++]);
+ string += String.fromCharCode(memory[address++]);
}
+ $rt_putStdoutCustom(string);
}
o.teavm.putwcharsOut = putwchars;
o.teavm.putwcharsErr = putwchars;