JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.88k stars 1.15k forks source link

kotlin/wasm Unable to display Chinese strings correctly #4054

Closed pengxiaohua575527452 closed 8 months ago

pengxiaohua575527452 commented 8 months ago

Describe the bug The Text() function cannot display the Chinese part of the same string correctly, but the println() function can display it correctly in devTools, so it should not be a problem during compilation.

Affected platforms

Versions

To Reproduce The following code demonstrates the problem:

@OptIn(ExperimentalComposeUiApi::class)
fun main(){
    window.document.body?.run {
        val parentElementId = "canvas-root-container"
        val canvasId = "canvas-root-id"
        appendChild(window.document.createElement("div").apply {
            setAttribute("id", parentElementId)
            appendChild(window.document.createElement("canvas").apply {
                setAttribute("id", canvasId)
            })
        })
        val str = "English content 无法显示的中文内容"
        CanvasBasedWindow(title = "title", canvasElementId = canvasId){
            Column {
                Text(str)
                println(str)
            }
        }
    }
}

Screenshots image

ShirasawaSama commented 8 months ago

duplicate https://github.com/JetBrains/compose-multiplatform/issues/3967

okushnikov commented 2 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.