Shared (again)

A starter project you can edit adopt adapt & pull code out of as you see fit

Lots o f stuff accumulated or written over many years

Pretty much everything is API 1

8 Likes

That is a huge collection of stuff. Some observations:

Runtime.IterateObjects can be slow and you may think about using

AllObjectsOfClassMBS(ClassName as String) as Variant()

from our plugin instead in some cases if MBS is there.

Second, before doing DefineEncoding, it may be good to check if string.encoding is not nil or valid:

Public Function UTF8StringValue(extends dbField as DatabaseField) As String
  dim s as string = dbField.StringValue
  
  if s.encoding = nil then
    if encodings.UTF8.IsValidData(s) then
      // mark as UTF-8
      Return DefineEncoding( s, Encodings.UTF8 )
    else
      // use a fallback encoding
      return DefineEncoding( s, encodings.ISOLatin1)
    end if
  else
    // make sure, we have UTF-8 and not UTF-16 or Windows encoding
    return ConvertEncoding(s, encodings.UTF8)
  end if
  
End Function

Dont want to inject a dependency on a plugin not everyone has

A worthy check

3 Likes

Thank you for this. It’s duly cloned and I look forward to having a look :slight_smile:

updated to handle the newly discovered string format
see Unknown String Operator \ new to me - General - Xojo Programming Forum

unit tests added as well
tokenizing can return a TOKEN which tells you type, how many bytes were read and the string value read
see changes in LanguageUtils TokenizeLine and TokenizeSource

1 Like