odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.38k stars 561 forks source link

Unicode does not show up in `odin run .` output, when unicode otherwise shows up #2482

Closed lesleyrs closed 1 year ago

lesleyrs commented 1 year ago

Context

Odin: dev-2023-04:341ba347 OS: Windows 10 Home Basic (version: 22H2), build 19045.2846

Expected Behavior

Expected to see the emoji from this example https://github.com/odin-lang/Odin#the-odin-programming-language

Current Behavior

The program "+ + * ­ƒÿâ - /" calculates the value 7

Running the type command does show the emojis.

Happens on both windows terminal and wezterm.

Steps to Reproduce

  1. Try the example code on the odin lang github linked above
  2. See output when ran
gingerBill commented 1 year ago

This isn't a bug with Odin but rather your terminal has not be configured to use UTF-8.

Kelimion commented 1 year ago

Try the command chcp 65001.

lesleyrs commented 1 year ago

I managed to fix the problem by following the 4th step here: https://akr.am/blog/posts/using-utf-8-in-the-windows-terminal. After restarting the unicode output of an odin binary shows up correctly, but it's behind a beta feature of windows.

chcp 65001 didn't work correctly for some reason even though the above should be doing the same under the hood, it only showed question marks (in cmd, no effect otherwise).

I just don't understand why utf-8 already works in windows terminal when manually typing or the output of a rust binary for example. But with Odin you have to enable this.