IPC.cr now correctly handles strings with accents (size vs bytesize).
This commit is contained in:
		
							parent
							
								
									2a46689a77
								
							
						
					
					
						commit
						6d751ad933
					
				
					 3 changed files with 4 additions and 4 deletions
				
			
		|  | @ -1,5 +1,5 @@ | ||||||
| name: ipc | name: ipc | ||||||
| version: 0.2.0 | version: 0.2.1 | ||||||
| 
 | 
 | ||||||
| authors: | authors: | ||||||
|   - Philippe Pittoli <karchnu@karchnu.fr> |   - Philippe Pittoli <karchnu@karchnu.fr> | ||||||
|  |  | ||||||
|  | @ -52,7 +52,7 @@ class IPC | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def write(fd : Int, string : String) |   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 |   end | ||||||
| 
 | 
 | ||||||
|   def write(fd : Int, buffer : UInt8*, buflen : UInt64) |   def write(fd : Int, buffer : UInt8*, buflen : UInt64) | ||||||
|  | @ -73,7 +73,7 @@ class IPC | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def schedule(fd : Int32, string : String) |   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 |   end | ||||||
| 
 | 
 | ||||||
|   def schedule(fd : Int32, buffer : Array(UInt8), buflen : Int32) |   def schedule(fd : Int32, buffer : Array(UInt8), buflen : Int32) | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ module IPCMessage | ||||||
|     property payload : Bytes |     property payload : Bytes | ||||||
| 
 | 
 | ||||||
|     def initialize(string : String) |     def initialize(string : String) | ||||||
|       @payload = Bytes.new string.to_unsafe, string.size |       @payload = Bytes.new string.to_unsafe, string.bytesize | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def initialize(@payload) |     def initialize(@payload) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue