TextView.st
changeset 4455 febe97112d50
parent 4450 ef24b9b60ec1
child 4456 b7212a96d7f4
--- a/TextView.st	Thu Sep 27 22:49:22 2012 +0200
+++ b/TextView.st	Sat Sep 29 20:22:45 2012 +0200
@@ -2311,6 +2311,18 @@
     self removeTrailingWhitespace.
 
     encoder := CharacterEncoder encoderToEncodeFrom:characterEncoding into:encodingSymOrNil.
+    encoder isNullEncoder ifTrue:[
+        (list contains:[:lineOrNil |
+                            lineOrNil notNil
+                            and:[lineOrNil string string bitsPerCharacter > 8]
+                       ]
+        ) ifTrue:[
+            (Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[
+                ^ self
+            ]
+        ].
+        encoder := CharacterEncoder encoderToEncodeFrom:'unicode' into:'utf8'
+    ].
 
     aStream isFileStream ifTrue:[
         "on some systems, writing linewise is very slow (via NFS)
@@ -4557,11 +4569,11 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.337 2012-09-06 14:05:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.338 2012-09-29 18:22:45 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.337 2012-09-06 14:05:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.338 2012-09-29 18:22:45 cg Exp $'
 ! !
 
 TextView initialize!