Skip to content

dioxus-cli fails to display Japanese characters correctly #4409

Open
@drakargx

Description

@drakargx

Problem

When using dioxus-cli to launch a Dioxus app, the tracing crate or println! will fail to display Japanese characters correctly. The characters will display correctly if cargo run is used instead.

This is probably true for other multi-byte unicode characters, but I only tested using Japanese characters.

Steps To Reproduce

Steps to reproduce the behavior:

Simple edit to a standard Dioxus starter template:

use dioxus::prelude::*;

const FAVICON: Asset = asset!("/assets/favicon.ico");
const MAIN_CSS: Asset = asset!("/assets/main.css");
const HEADER_SVG: Asset = asset!("/assets/header.svg");

fn main() {
    println!("読む");
    dioxus::launch(App);
}

#[component]
fn App() -> Element {
    rsx! {
        document::Link { rel: "icon", href: FAVICON }
        document::Link { rel: "stylesheet", href: MAIN_CSS }
        Hero {}

    }
}

#[component]
pub fn Hero() -> Element {
    rsx! {
        div {
            id: "hero",
            img { src: HEADER_SVG, id: "header" }
            div { id: "links",
                a { href: "https://dioxuslabs.com/learn/0.6/", "📚 Learn Dioxus" }
                a { href: "https://dioxuslabs.com/awesome", "🚀 Awesome Dioxus" }
                a { href: "https://github.com/dioxus-community/", "📡 Community Libraries" }
                a { href: "https://github.com/DioxusLabs/sdk", "⚙️ Dioxus Development Kit" }
                a { href: "https://marketplace.visualstudio.com/items?itemName=DioxusLabs.dioxus", "💫 VSCode Extension" }
                a { href: "https://discord.gg/XgGxMSkvUM", "👋 Community Discord" }
            }
        }
    }
}

Expected behavior

The text should display in the terminal correctly.

Screenshots

Image

It should print out 読む but only displays the first character. When running cargo run:

Image

Environment:

  • Dioxus version: Tested on both 0.7.0-alpha.2 and 0.6.3
  • Rust version: 1.89.0
  • OS info: Reproduced on both Windows 11 and on an Arch Linux installation
  • App platform: Desktop

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliRelated to the dioxus-cli program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions