Replacing encode/decode-utf8 with utf8 encode/decode-string
parent
5805db7ac4
commit
e06885550e
|
@ -0,0 +1,5 @@
|
|||
USING: io.encodings io io.streams.byte-array ;
|
||||
IN: io.encodings.string
|
||||
|
||||
: decode-string ( byte-array encoding -- string )
|
||||
<byte-reader> contents ;
|
|
@ -2,9 +2,9 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: hashtables io io.streams.string kernel math namespaces
|
||||
math.parser assocs sequences strings splitting ascii
|
||||
io.encodings.utf8 namespaces unicode.case combinators
|
||||
vectors sorting new-slots accessors calendar calendar.format
|
||||
quotations arrays ;
|
||||
io.encodings.utf8 io.encodings io.encodings.string namespaces
|
||||
unicode.case combinators vectors sorting new-slots accessors
|
||||
calendar calendar.format quotations arrays ;
|
||||
IN: http
|
||||
|
||||
: http-port 80 ; inline
|
||||
|
@ -18,7 +18,7 @@ IN: http
|
|||
swap "/_-." member? or ; foldable
|
||||
|
||||
: push-utf8 ( ch -- )
|
||||
1string encode-utf8 [ CHAR: % , >hex 2 CHAR: 0 pad-left % ] each ;
|
||||
1string utf8 encode-string [ CHAR: % , >hex 2 CHAR: 0 pad-left % ] each ;
|
||||
|
||||
: url-encode ( str -- str )
|
||||
[ [
|
||||
|
@ -50,7 +50,7 @@ IN: http
|
|||
] if ;
|
||||
|
||||
: url-decode ( str -- str )
|
||||
[ 0 swap url-decode-iter ] "" make decode-utf8 ;
|
||||
[ 0 swap url-decode-iter ] "" make utf8 decode-string ;
|
||||
|
||||
: crlf "\r\n" write ;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: alien alien.c-types arrays ui ui.gadgets ui.gestures
|
||||
ui.backend ui.clipboards ui.gadgets.worlds assocs kernel math
|
||||
namespaces opengl sequences strings x11.xlib x11.events x11.xim
|
||||
x11.glx x11.clipboard x11.constants x11.windows
|
||||
x11.glx x11.clipboard x11.constants x11.windows io.encodings
|
||||
io.encodings.utf8 combinators debugger system command-line
|
||||
ui.render math.vectors tuples opengl.gl threads ;
|
||||
IN: ui.x11
|
||||
|
@ -137,7 +137,7 @@ M: world selection-notify-event
|
|||
|
||||
: encode-clipboard ( string type -- bytes )
|
||||
XSelectionRequestEvent-target XA_UTF8_STRING =
|
||||
[ encode-utf8 ] [ string>char-alien ] if ;
|
||||
[ utf8 encode-string ] [ string>char-alien ] if ;
|
||||
|
||||
: set-selection-prop ( evt -- )
|
||||
dpy get swap
|
||||
|
@ -212,7 +212,7 @@ M: x-clipboard paste-clipboard
|
|||
: set-title-new ( dpy window string -- )
|
||||
>r
|
||||
XA_NET_WM_NAME XA_UTF8_STRING 8 PropModeReplace
|
||||
r> encode-utf8 dup length XChangeProperty drop ;
|
||||
r> utf8 encode-string dup length XChangeProperty drop ;
|
||||
|
||||
M: x11-ui-backend set-title ( string world -- )
|
||||
world-handle x11-handle-window swap dpy get -rot
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
! Copyright (C) 2006, 2007 Slava Pestov
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien alien.c-types alien.syntax arrays kernel math
|
||||
namespaces sequences io.encodings.utf8 x11.xlib x11.constants ;
|
||||
namespaces sequences io.encodings.string io.encodings.utf8 x11.xlib
|
||||
x11.constants ;
|
||||
IN: x11.clipboard
|
||||
|
||||
! This code was based on by McCLIM's Backends/CLX/port.lisp
|
||||
|
@ -35,7 +36,7 @@ TUPLE: x-clipboard atom contents ;
|
|||
>r XSelectionEvent-property zero? [
|
||||
r> drop f
|
||||
] [
|
||||
r> selection-property 1 window-property decode-utf8
|
||||
r> selection-property 1 window-property utf8 decode-string
|
||||
] if ;
|
||||
|
||||
: own-selection ( prop win -- )
|
||||
|
|
Loading…
Reference in New Issue