Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf8 support #5

Open
ZelphirKaltstahl opened this issue May 27, 2017 · 2 comments
Open

utf8 support #5

ZelphirKaltstahl opened this issue May 27, 2017 · 2 comments

Comments

@ZelphirKaltstahl
Copy link

ZelphirKaltstahl commented May 27, 2017

I am running a little tutorial project with awful, outputting Chinese characters using SXML. For example as follows:

I am requiring the utf8 extension:

(require-extension utf8)

Then one example part goes as follows:

(td ,(render-hanci (simplified a-word)))

Where render-hanci is:

(define (render-hanci hanci)
  (define (render-hanzi hanzi)
    `(div (@ (class "hanzi-container"))
          (p (@ (class "hanzi"))
             ,hanzi)))
  (map render-hanzi (utf8-string->list hanci)))

("hanci" meaning "word" and "hanzi" meaning character.) Where utf8-string->list is:

(define (utf8-string->list a-string)
  (define (iter the-string ind result)
    (cond [(< ind (string-length the-string))
           (display "current character is: ") (display (string-ref the-string ind)) (newline)
           (iter the-string (+ ind 1) (cons (string-ref the-string ind) result))]
          [else
           result]))
  (reverse (iter a-string 0 (list))))

This is a procedure, which I created to check what the single characters of the list are and to see if my understanding of how to handle utf8 is correct. The characters being displayed when this code runs are the correct Chinese characters. However, when I check on the website, I get wrong characters. To show what I mean I will add a screenshot:

image

I can post my whole code (here it is), if needed in a repository. However, I'd like to know, if there is any reason, why awful might/cannot not support unicode characters out of the box in SXML expressions.

Info

  • OS: Xubuntu 16.04

  • Chicken Scheme version:

      CHICKEN
      (c) 2008-2014, The Chicken Team
      (c) 2000-2007, Felix L. Winkelmann
      Version 4.9.0.1 (stability/4.9.0) (rev 8b3189b)
      linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
      bootstrapped 2014-06-07
    
@mario-goulart
Copy link
Owner

Hello Zelphir,

Thanks for the detailed report. I don't know for sure what the cause of the problem is, but it seems to be related to CHICKEN (I can reproduce the issue with the latest version, 4.12.0). I've created a ticket in CHICKEN's bug tracker: http://bugs.call-cc.org/ticket/1374 .

All the best.
Mario

@ZelphirKaltstahl
Copy link
Author

Thanks for that. I am not sure I am using the utf8 extension correctly, as I do not fully understand how use and require-extension and import work yet. However, if you saw no mistake there, maybe I did it right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants