bohonghuang / cl-gtk4

GTK4/Libadwaita/WebKit2 bindings for Common Lisp.
GNU Lesser General Public License v3.0
215 stars 9 forks source link

Unicode support #68

Open douglasmaieski opened 2 months ago

douglasmaieski commented 2 months ago

Hi,

I noticed some problems regarding Unicode text, I'm using the following function to go around it:

(defun fix-text-utf8 (s)
  (let* ((encoded (babel:string-to-octets s))
         (real-len (length encoded))
         (diff (- (length encoded) (length s))))
    (str:concat s (str:repeat diff " "))))

and the example where it's needed:

(gtk4:text-buffer-insert buffer iter-start (fix-text-utf8 proper-replacement))