Mark Sibly 9 gadi atpakaļ
vecāks
revīzija
56d808fea9

+ 10 - 11
modules/std/memory/databuffer.monkey2

@@ -263,7 +263,7 @@ Class DataBuffer Extends std.resource.Resource
 	
 	
 	If `count` is omitted, all bytes from `offset` until the end of the data buffer are read.
 	If `count` is omitted, all bytes from `offset` until the end of the data buffer are read.
 	
 	
-	`encoding` should be one of "utf8" or "ascii".
+	`encoding` should be one of "utf8" or "ansi".
 
 
 	@param offset Byte offset to read the string.
 	@param offset Byte offset to read the string.
 	
 	
@@ -280,11 +280,10 @@ Class DataBuffer Extends std.resource.Resource
 	
 	
 	Method PeekString:String( offset:Int,count:Int,encoding:String="utf8" )
 	Method PeekString:String( offset:Int,count:Int,encoding:String="utf8" )
 		DebugAssert( offset>=0 And count>=0 And offset+count<=_length )
 		DebugAssert( offset>=0 And count>=0 And offset+count<=_length )
-		DebugAssert( encoding="utf8" Or encoding="ascii" )
-		
-		If encoding="utf8" Return String.FromUtf8Data( _data+offset,count )
+
+		If encoding="ansi" Or encoding="ascii" Return String.FromAsciiData( _data+offset,count )
 		
 		
-		Return String.FromAsciiData( _data+offset,count )
+		Return String.FromUtf8Data( _data+offset,count )
 	End
 	End
 	
 	
 	#rem monkeydoc Writes a byte to the databuffer
 	#rem monkeydoc Writes a byte to the databuffer
@@ -427,7 +426,7 @@ Class DataBuffer Extends std.resource.Resource
 
 
 	#rem monkeydoc Write a string to the databuffer.
 	#rem monkeydoc Write a string to the databuffer.
 
 
-	`encoding` should be one of "utf8" or "ascii".
+	`encoding` should be one of "utf8" or "ansi".
 	
 	
 	If there is not enough room in the data buffer, the string data is truncated.
 	If there is not enough room in the data buffer, the string data is truncated.
 	
 	
@@ -443,14 +442,14 @@ Class DataBuffer Extends std.resource.Resource
 		
 		
 		DebugAssert( encoding="utf8" Or encoding="ascii" )
 		DebugAssert( encoding="utf8" Or encoding="ascii" )
 		
 		
-		If encoding="utf8"
-			Local count:=value.Utf8Length
-			If offset+count>_length count=_length-offset
-			value.ToUtf8String( _data+offset,count )
-		Else
+		If encoding="ansi" Or encoding="ascii"
 			Local count:=value.Length
 			Local count:=value.Length
 			If offset+count>_length count=_length-offset
 			If offset+count>_length count=_length-offset
 			value.ToCString( _data+offset,count )
 			value.ToCString( _data+offset,count )
+		Else
+			Local count:=value.Utf8Length
+			If offset+count>_length count=_length-offset
+			value.ToUtf8String( _data+offset,count )
 		Endif
 		Endif
 
 
 	End
 	End

+ 1 - 1
modules/std/socket/socket.monkey2

@@ -150,7 +150,7 @@ Struct Socket
 	
 	
 	Returns a closed socket upon failue.
 	Returns a closed socket upon failue.
 	
 	
-	@Return A new socket.
+	@return A new socket.
 	
 	
 	#end	
 	#end	
 	Function Connect:Socket( hostname:String,service:String )
 	Function Connect:Socket( hostname:String,service:String )

+ 6 - 2
modules/std/stream/stream.monkey2

@@ -301,6 +301,8 @@ Class Stream
 	
 	
 	#rem monkeydoc Reads a null terminated string from the stream.
 	#rem monkeydoc Reads a null terminated string from the stream.
 	
 	
+	@param encoding The string encoding, "utf8" or "ansi".
+	
 	@return the string read.
 	@return the string read.
 	
 	
 	#end
 	#end
@@ -311,8 +313,10 @@ Class Stream
 			If Not chr Exit
 			If Not chr Exit
 			buf.Push( chr )
 			buf.Push( chr )
 		Wend
 		Wend
-		If encoding="utf8" Return String.FromUtf8Data( buf.Data.Data,buf.Length )
-		Return String.FromAsciiData( buf.Data.Data,buf.Length )
+		
+		If encoding="ansi" Or encoding="ascii" Return String.FromAsciiData( buf.Data.Data,buf.Length )
+		
+		Return String.FromUtf8Data( buf.Data.Data,buf.Length )
 	End
 	End
 	
 	
 	#rem monkeydoc Writes a byte to the stream.
 	#rem monkeydoc Writes a byte to the stream.