Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Util/Universal Encoding Detection
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/Universal Encoding Detection
This example is the version from Sun, 17th Mar 2012.
Project "Universal Encoding Detection.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open() const t = "Die heutige Pfarrkirche ist wohl die dritte ihrer Art. Dem ersten Bau folgte gegen 1200 die zweite Kirche, die auf den Resten einer römischen Villa errichtet wurde. " const j = "21.5インチと27インチ、2つのディスプレイ。" // check japanese text test j test ConvertEncoding(j,encodings.UTF16) test ConvertEncoding(j,encodings.ShiftJIS) test ConvertEncoding(j,encodings.MacJapanese) // check west european text test t test ConvertEncoding(t,encodings.WindowsANSI) // BOM Checks dim bom as string = DefineEncoding(chr(&hEF)+chr(&hBB)+chr(&hBF)+"Hello",encodings.UTF8) test bom test ConvertEncoding(bom,encodings.UTF16) test ConvertEncoding(bom,encodings.UTF16LE) test ConvertEncoding(bom,encodings.UTF16BE) test ConvertEncoding(bom,encodings.UTF32LE) test ConvertEncoding(bom,encodings.UTF32BE) // Hebrew const h="בגדהוזחטיךכלםמןF-נסעףפץצקרשת" test h test ConvertEncoding(h,encodings.WindowsHebrew) // Cryllic const k="Экран, от которого невозможно отвести взгляд. Более мощный процессор, чем когда-либо прежде. Первая в мире мышь Multi-Touch. Новый iMac не только выглядит великолепно. Он действительно великолепен." test k test ConvertEncoding(k,encodings.WindowsCyrillic) End EventHandler
Sub test(text as string) dim u as new UniversalCharacterDetectionMBS(UniversalCharacterDetectionMBS.FilterAll) u.AddData text u.Finish List.addrow ConvertEncoding(text,encodings.UTF8) List.cell(list.lastindex, 1)=text.Encoding.internetName List.cell(list.lastindex, 2)=u.LastCharSet End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Util Plugin.

MBS FileMaker blog