Git Product home page Git Product logo

Comments (6)

gokcehan avatar gokcehan commented on August 12, 2024 1

Ok so I have tried the following:

package main

import "fmt"

func main() {
    s := "第四章電路性能分析.ppt"

    println(s)
    fmt.Println(s)

    for _, r := range s {
        fmt.Printf("%c", r)
    }
}

and it printed:

第四章電路性能分析.ppt
第四章電路性能分析.ppt
第四章電路性能分析.ppt

Then for termbox I tried:

package main

import (
    "github.com/nsf/termbox-go"
)

func main() {
    if err := termbox.Init(); err != nil {
        panic(err)
    }
    defer termbox.Close()

    s := "第四章電路性能分析.ppt"

    termbox.Clear(termbox.ColorDefault, termbox.ColorDefault)

    i := 0
    for _, r := range s {
        termbox.SetCell(i, 0, r, termbox.ColorDefault, termbox.ColorDefault)
        i++
    }

    termbox.Flush()

    termbox.PollEvent()
}

and it showed:

第章路能析ppt

So it looks like termbox related issue. I will take a further look at it later on.

from lf.

gokcehan avatar gokcehan commented on August 12, 2024 1

@wheatdog Ok so it seems that there were two issues. First, the implementation was still using a quick and dirty logic using []byte which is now properly replaced with []rune. Second, we were not handling full width unicode CJK characters. This was more difficult and I had to add an extra dependency to the repo to make it work. Now the example you have provided seems to be working fine. More testing would be welcomed though as I still don't trust my understanding of unicodes.

Also note that, this fix is only for the filenames display yet. We still need to do the same for command prompt and configuration file.

from lf.

gokcehan avatar gokcehan commented on August 12, 2024

@wheatdog From what I see in the screenshot, it seems to work for some characters but not for others. This is interesting. I suspect this issue is lf related though. It could be go related or maybe termbox related. Can you copy that filename here as a string so that I can do some testing?

from lf.

KenjiTakahashi avatar KenjiTakahashi commented on August 12, 2024

This is strange. Does it work correctly in other cli utils? E.g. ls -l or sth.

from lf.

wheatdog avatar wheatdog commented on August 12, 2024

The string is "第四章電路性能分析.ppt".

I am using st from suckless.org , and ls works.

screenshot-0

from lf.

gokcehan avatar gokcehan commented on August 12, 2024

It seems that unicode in the evaluator was already working. I have now fixed rune widths in the prompt as well. Closing this issue now.

from lf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.