Jailout2000

REALbasic Encoding Problem

Aug 6th, 2011
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub ChangeInputEncoding(NewEncoding As TextEncoding)
  2.  
  3. '// rtfInput is a TextArea control in a Window class.
  4. '// CurrentType and Type* is an integer representing the type of data (Raw/Hex/Bin/Oct, respectively).
  5.  
  6. '// As another note, I also tried doing:
  7. '// rtfInput.Text.Encoding = NewEncoding
  8. '// rtfInput.Text = ConvertEncoding(...)
  9. '// ...which both failed.
  10.  
  11.   Dim EncToA As TextEncoding = NewEncoding
  12.   Dim EncFrmA As TextEncoding = rtfInput.Text.Encoding
  13.  
  14.   Dim EncFrmB, EncFrmC As TextEncoding
  15.  
  16.   If Self.CurrentType = Self.TypeRaw Then
  17.     Dim sTmp As String = ConvertEncoding(rtfInput.Text, NewEncoding)
  18.     rtfInput.Text = sTmp
  19.     EncFrmB = rtfInput.Text.Encoding
  20.     EncFrmC = sTmp.Encoding
  21.     Break
  22.   End If
  23.  
  24. '// EncFrmA     = ptr(&hB3D7546D)
  25. '// EncFrmB     = ptr(&hB3D7546D)
  26. '// EncFrmC     = ptr(&h23D6546D)
  27. '// EncToA      = ptr(&h23D6546D)
  28. '// NewEncoding = ptr(&h23D6546D)
  29.  
  30. '// Conclusion:
  31. '// REALbasic does not allow changing TextArea.Text's encoding.
  32.  
  33. End Sub
Advertisement
Add Comment
Please, Sign In to add comment