Hi folks!
I encountered a bug in my project for these days. Finally I realized it's
because of my locale is zh_CN.UTF-8 in default. But in many protocols, it
needs
the result of strftime be in English. Anyway, I think there should be an
elegant way to change locale temperately. So I think maybe with-locale
would be useful.

---------------------------------------------------------------------
(define-syntax-rule (with-locale i c e0 e1 ...)
  (let ([old (setlocale i)])
    (dynamic-wind
    (lambda () (setlocale i c))
    (lambda () (begin e0 e1 ...))
    (lambda () (setlocale i old)))))
---------------------------------------------------------------------

What you guys think?

Regards.

Reply via email to