IPC.cr now correctly handles strings with accents (size vs bytesize).

This commit is contained in:
Philippe PITTOLI 2024-06-28 23:16:45 +02:00
parent 2a46689a77
commit 6d751ad933
3 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
name: ipc
version: 0.2.0
version: 0.2.1
authors:
- Philippe Pittoli <karchnu@karchnu.fr>

View File

@ -52,7 +52,7 @@ class IPC
end
def write(fd : Int, string : String)
self.write(fd, string.to_unsafe, string.size.to_u64)
self.write(fd, string.to_unsafe, string.bytesize.to_u64)
end
def write(fd : Int, buffer : UInt8*, buflen : UInt64)
@ -73,7 +73,7 @@ class IPC
end
def schedule(fd : Int32, string : String)
self.schedule(fd, string.to_unsafe, string.size.to_u64)
self.schedule(fd, string.to_unsafe, string.bytesize.to_u64)
end
def schedule(fd : Int32, buffer : Array(UInt8), buflen : Int32)

View File

@ -11,7 +11,7 @@ module IPCMessage
property payload : Bytes
def initialize(string : String)
@payload = Bytes.new string.to_unsafe, string.size
@payload = Bytes.new string.to_unsafe, string.bytesize
end
def initialize(@payload)