[API]
RtlMoveMemory

[CODE]
Public Function MkHTML(ByVal OrigText As String) As String
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xChar1 As String
  
  For xLong1 = 1& To Len(OrigText)
    xChar1 = Mid(OrigText, xLong1, 1&)
    Call RtlMoveMemory(ByVal VarPtr(xLong2), ByVal StrPtr(xChar1), 2&)
    Select Case xLong2
      'Case 96&, 92& ' `\
      '  IsValidForMySQLRow = False
      '  Exit For
      'Case 9&
      '  MkHTML = MkHTML + "&#09;"
      Case 10&
        MkHTML = MkHTML + "<br>"
      Case 13&
        If Not Mid(OrigText, xLong1 + 1&, 1&) = Chr(10&) Then
          MkHTML = MkHTML + "<br>"
          End If
      Case 34&
        MkHTML = MkHTML + "&quot;"
      Case 38&
        If Mid(OrigText, xLong1 + 1&, 1&) = "#" Then 'And Not IsUnicode Then
          MkHTML = MkHTML + "&"
          Else
          MkHTML = MkHTML + "&amp;"
          End If
      'Case 39&: MkHTML = MkHTML + "''" ''
      'Case 47&: MkHTML = MkHTML + "&frasl;" '/
      Case 60&: MkHTML = MkHTML + "&lt;" '<
      Case 62&: MkHTML = MkHTML + "&gt;" '>
      'Case 92&: MkHTML = MkHTML + "\\" '\
      
      Case 32 To 126
        MkHTML = MkHTML + Mid(OrigText, xLong1, 1&)
      
      Case 150&: MkHTML = MkHTML + "&ndash;"
      Case 151&: MkHTML = MkHTML + "&mdash;"
      Case 160&: MkHTML = MkHTML + "&nbsp;"
      Case 161&: MkHTML = MkHTML + "&iexcl;"
      Case 162&: MkHTML = MkHTML + "&cent;"
      Case 163&: MkHTML = MkHTML + "&pound;"
      Case 164&: MkHTML = MkHTML + "&curren;"
      Case 165&: MkHTML = MkHTML + "&yen;"
      Case 166&: MkHTML = MkHTML + "&brvbar;"
      Case 167&: MkHTML = MkHTML + "&sect;"
      Case 168&: MkHTML = MkHTML + "&uml;"
      Case 169&: MkHTML = MkHTML + "&copy;"
      Case 170&: MkHTML = MkHTML + "&ordf;"
      Case 171&: MkHTML = MkHTML + "&laquo;"
      Case 172&: MkHTML = MkHTML + "&not;"
      Case 173&: MkHTML = MkHTML + "&shy;"
      Case 174&: MkHTML = MkHTML + "&reg;"
      Case 175&: MkHTML = MkHTML + "&macr;"
      Case 176&: MkHTML = MkHTML + "&deg;"
      Case 177&: MkHTML = MkHTML + "&plusmn;"
      Case 178&: MkHTML = MkHTML + "&sup2;"
      Case 179&: MkHTML = MkHTML + "&sup3;"
      Case 180&: MkHTML = MkHTML + "&acute;"
      Case 181&: MkHTML = MkHTML + "&micro;"
      Case 182&: MkHTML = MkHTML + "&para;"
      Case 183&: MkHTML = MkHTML + "&middot;"
      Case 184&: MkHTML = MkHTML + "&cedil;"
      Case 185&: MkHTML = MkHTML + "&sup1;"
      Case 186&: MkHTML = MkHTML + "&ordm;"
      Case 187&: MkHTML = MkHTML + "&raquo;"
      Case 188&: MkHTML = MkHTML + "&frac14;"
      Case 189&: MkHTML = MkHTML + "&frac12;"
      Case 190&: MkHTML = MkHTML + "&frac34;"
      Case 191&: MkHTML = MkHTML + "&iquest;"
      Case 192&: MkHTML = MkHTML + "&Agrave;"
      Case 193&: MkHTML = MkHTML + "&Aacute;"
      Case 194&: MkHTML = MkHTML + "&Acirc;"
      Case 195&: MkHTML = MkHTML + "&Atilde;"
      Case 196&: MkHTML = MkHTML + "&Auml;" 'Ä
      Case 197&: MkHTML = MkHTML + "&Aring;"
      Case 198&: MkHTML = MkHTML + "&AElig;"
      Case 199&: MkHTML = MkHTML + "&Ccedil;"
      Case 200&: MkHTML = MkHTML + "&Egrave;"
      Case 201&: MkHTML = MkHTML + "&Eacute;"
      Case 202&: MkHTML = MkHTML + "&Ecirc;"
      Case 203&: MkHTML = MkHTML + "&Euml;"
      Case 204&: MkHTML = MkHTML + "&Igrave;"
      Case 205&: MkHTML = MkHTML + "&Iacute;"
      Case 206&: MkHTML = MkHTML + "&Icirc;"
      Case 207&: MkHTML = MkHTML + "&Iuml;"
      Case 208&: MkHTML = MkHTML + "&ETH;"
      Case 209&: MkHTML = MkHTML + "&Ntilde;"
      Case 210&: MkHTML = MkHTML + "&Ograve;"
      Case 211&: MkHTML = MkHTML + "&Oacute;"
      Case 212&: MkHTML = MkHTML + "&Ocirc;"
      Case 213&: MkHTML = MkHTML + "&Otilde;"
      Case 214&: MkHTML = MkHTML + "&Ouml;" 'Ö
      Case 215&: MkHTML = MkHTML + "&times;"
      Case 216&: MkHTML = MkHTML + "&Oslash;"
      Case 217&: MkHTML = MkHTML + "&Ugrave;"
      Case 218&: MkHTML = MkHTML + "&Uacute;"
      Case 219&: MkHTML = MkHTML + "&Ucirc;"
      Case 220&: MkHTML = MkHTML + "&Uuml;" 'Ü
      Case 221&: MkHTML = MkHTML + "&Yacute;"
      Case 222&: MkHTML = MkHTML + "&THORN;"
      Case 223&: MkHTML = MkHTML + "&szlig;" 'ß
      Case 224&: MkHTML = MkHTML + "&agrave;"
      Case 225&: MkHTML = MkHTML + "&aacute;"
      Case 226&: MkHTML = MkHTML + "&acirc;"
      Case 227&: MkHTML = MkHTML + "&atilde;"
      Case 228&: MkHTML = MkHTML + "&auml;" 'ä
      Case 229&: MkHTML = MkHTML + "&aring;"
      Case 230&: MkHTML = MkHTML + "&aelig;"
      Case 231&: MkHTML = MkHTML + "&ccedil;"
      Case 232&: MkHTML = MkHTML + "&egrave;"
      Case 233&: MkHTML = MkHTML + "&eacute;"
      Case 234&: MkHTML = MkHTML + "&ecirc;"
      Case 235&: MkHTML = MkHTML + "&euml;"
      Case 236&: MkHTML = MkHTML + "&igrave;"
      Case 237&: MkHTML = MkHTML + "&iacute;"
      Case 238&: MkHTML = MkHTML + "&icirc;"
      Case 239&: MkHTML = MkHTML + "&iuml;"
      Case 240&: MkHTML = MkHTML + "&eth;"
      Case 241&: MkHTML = MkHTML + "&ntilde;"
      Case 242&: MkHTML = MkHTML + "&ograve;"
      Case 243&: MkHTML = MkHTML + "&oacute;"
      Case 244&: MkHTML = MkHTML + "&ocirc;"
      Case 245&: MkHTML = MkHTML + "&otilde;"
      Case 246&: MkHTML = MkHTML + "&ouml;" 'ö
      Case 247&: MkHTML = MkHTML + "&divide;"
      Case 248&: MkHTML = MkHTML + "&oslash;"
      Case 249&: MkHTML = MkHTML + "&ugrave;"
      Case 250&: MkHTML = MkHTML + "&uacute;"
      Case 251&: MkHTML = MkHTML + "&ucirc;"
      Case 252&: MkHTML = MkHTML + "&uuml;" 'ü
      Case 253&: MkHTML = MkHTML + "&yacute;"
      Case 254&: MkHTML = MkHTML + "&thorn;"
      Case 255&: MkHTML = MkHTML + "&yuml;"
      
      Case 402&: MkHTML = MkHTML + "&fnof;"
      Case 913&: MkHTML = MkHTML + "&Alpha;"
      Case 914&: MkHTML = MkHTML + "&Beta;"
      Case 915&: MkHTML = MkHTML + "&Gamma;"
      Case 916&: MkHTML = MkHTML + "&Delta;"
      Case 917&: MkHTML = MkHTML + "&Epsilon;"
      Case 918&: MkHTML = MkHTML + "&Zeta;"
      Case 919&: MkHTML = MkHTML + "&Eta;"
      Case 920&: MkHTML = MkHTML + "&Theta;"
      Case 921&: MkHTML = MkHTML + "&Iota;"
      Case 922&: MkHTML = MkHTML + "&Kappa;"
      Case 923&: MkHTML = MkHTML + "&Lambda;"
      Case 924&: MkHTML = MkHTML + "&Mu;"
      Case 925&: MkHTML = MkHTML + "&Nu;"
      Case 926&: MkHTML = MkHTML + "&Xi;"
      Case 927&: MkHTML = MkHTML + "&Omicron;"
      Case 928&: MkHTML = MkHTML + "&Pi;"
      Case 929&: MkHTML = MkHTML + "&Rho;"
      Case 931&: MkHTML = MkHTML + "&Sigma;"
      Case 932&: MkHTML = MkHTML + "&Tau;"
      Case 933&: MkHTML = MkHTML + "&Upsilon;"
      Case 934&: MkHTML = MkHTML + "&Phi;"
      Case 935&: MkHTML = MkHTML + "&Chi;"
      Case 936&: MkHTML = MkHTML + "&Psi;"
      Case 937&: MkHTML = MkHTML + "&Omega;"
      Case 945&: MkHTML = MkHTML + "&alpha;"
      Case 946&: MkHTML = MkHTML + "&beta;"
      Case 947&: MkHTML = MkHTML + "&gamma;"
      Case 948&: MkHTML = MkHTML + "&delta;"
      Case 949&: MkHTML = MkHTML + "&epsilon;"
      Case 950&: MkHTML = MkHTML + "&zeta;"
      Case 951&: MkHTML = MkHTML + "&eta;"
      Case 952&: MkHTML = MkHTML + "&theta;"
      Case 953&: MkHTML = MkHTML + "&iota;"
      Case 954&: MkHTML = MkHTML + "&kappa;"
      Case 955&: MkHTML = MkHTML + "&lambda;"
      Case 956&: MkHTML = MkHTML + "&mu;"
      Case 957&: MkHTML = MkHTML + "&nu;"
      Case 958&: MkHTML = MkHTML + "&xi;"
      Case 959&: MkHTML = MkHTML + "&omicron;"
      Case 960&: MkHTML = MkHTML + "&pi;"
      Case 961&: MkHTML = MkHTML + "&rho;"
      Case 962&: MkHTML = MkHTML + "&sigmaf;"
      Case 963&: MkHTML = MkHTML + "&sigma;"
      Case 964&: MkHTML = MkHTML + "&tau;"
      Case 965&: MkHTML = MkHTML + "&upsilon;"
      Case 966&: MkHTML = MkHTML + "&phi;"
      Case 967&: MkHTML = MkHTML + "&chi;"
      Case 968&: MkHTML = MkHTML + "&psi;"
      Case 969&: MkHTML = MkHTML + "&omega;"
      Case 977&: MkHTML = MkHTML + "&thetasym;"
      Case 978&: MkHTML = MkHTML + "&upsih;"
      Case 982&: MkHTML = MkHTML + "&piv;"
      
      Case 8194&: MkHTML = MkHTML + "&ensp;"
      Case 8195&: MkHTML = MkHTML + "&emsp;"
      Case 8201&: MkHTML = MkHTML + "&thinsp;"
      Case 8204&: MkHTML = MkHTML + "&zwnj;"
      Case 8205&: MkHTML = MkHTML + "&zwj;"
      Case 8206&: MkHTML = MkHTML + "&lrm;"
      Case 8207&: MkHTML = MkHTML + "&rlm;"

      Case 8211&: MkHTML = MkHTML + "&ndash;"
      Case 8212&: MkHTML = MkHTML + "&mdash;"
      
      Case 8216&: MkHTML = MkHTML + "&lsquo;"
      Case 8217&: MkHTML = MkHTML + "&rsquo;"
      Case 8218&: MkHTML = MkHTML + "&sbquo;"
      
      Case 8220&: MkHTML = MkHTML + "&ldquo;" ' special ""s
      Case 8221&: MkHTML = MkHTML + "&rdquo;" ' special ""s
      Case 8222&: MkHTML = MkHTML + "&bdquo;"
      Case 8224&: MkHTML = MkHTML + "&dagger;"
      Case 8225&: MkHTML = MkHTML + "&Dagger;"
      Case 8226&: MkHTML = MkHTML + "&bull;"
      Case 8230&: MkHTML = MkHTML + "&hellip;"
      Case 8240&: MkHTML = MkHTML + "&permil;"
      Case 8242&: MkHTML = MkHTML + "&prime;"
      Case 8243&: MkHTML = MkHTML + "&Prime;"
      Case 8249&: MkHTML = MkHTML + "&lsaquo;"
      Case 8250&: MkHTML = MkHTML + "&rsaquo;"
      Case 8254&: MkHTML = MkHTML + "&oline;"
      Case 8260&: MkHTML = MkHTML + "&frasl;"
      Case 8364&: MkHTML = MkHTML + "&euro;"
      Case 8465&: MkHTML = MkHTML + "&image;"
      Case 8472&: MkHTML = MkHTML + "&weierp;"
      Case 8476&: MkHTML = MkHTML + "&real;"
      Case 8482&: MkHTML = MkHTML + "&trade;"
      Case 8501&: MkHTML = MkHTML + "&alefsym;"
      Case 8592&: MkHTML = MkHTML + "&larr;"
      Case 8593&: MkHTML = MkHTML + "&uarr;"
      Case 8594&: MkHTML = MkHTML + "&rarr;"
      Case 8595&: MkHTML = MkHTML + "&darr;"
      Case 8596&: MkHTML = MkHTML + "&harr;"
      Case 8629&: MkHTML = MkHTML + "&carr;"
      Case 8656&: MkHTML = MkHTML + "&lArr;"
      Case 8657&: MkHTML = MkHTML + "&uArr;"
      Case 8658&: MkHTML = MkHTML + "&rArr;"
      Case 8659&: MkHTML = MkHTML + "&dArr;"
      Case 8660&: MkHTML = MkHTML + "&hArr;"
      
      Case 8704&: MkHTML = MkHTML + "&forall;"
      Case 8706&: MkHTML = MkHTML + "&part;"
      Case 8707&: MkHTML = MkHTML + "&exist;"
      Case 8709&: MkHTML = MkHTML + "&empty;"
      Case 8711&: MkHTML = MkHTML + "&nabla;"
      Case 8712&: MkHTML = MkHTML + "&isin;"
      Case 8713&: MkHTML = MkHTML + "&notin;"
      Case 8715&: MkHTML = MkHTML + "&ni;"
      Case 8719&: MkHTML = MkHTML + "&prod;"
      Case 8721&: MkHTML = MkHTML + "&sum;"
      Case 8722&: MkHTML = MkHTML + "&minus;"
      Case 8727&: MkHTML = MkHTML + "&lowast;"
      Case 8730&: MkHTML = MkHTML + "&radic;"
      Case 8733&: MkHTML = MkHTML + "&prop;"
      Case 8734&: MkHTML = MkHTML + "&infin;"
      Case 8736&: MkHTML = MkHTML + "&ang;"
      Case 8743&: MkHTML = MkHTML + "&and;"
      Case 8744&: MkHTML = MkHTML + "&or;"
      Case 8745&: MkHTML = MkHTML + "&cap;"
      Case 8746&: MkHTML = MkHTML + "&cup;"
      Case 8747&: MkHTML = MkHTML + "&int;"
      Case 8756&: MkHTML = MkHTML + "&there4;"
      Case 8764&: MkHTML = MkHTML + "&sim;"
      Case 8773&: MkHTML = MkHTML + "&cong;"
      Case 8776&: MkHTML = MkHTML + "&asymp;"
      Case 8800&: MkHTML = MkHTML + "&ne;"
      Case 8801&: MkHTML = MkHTML + "&equiv;"
      Case 8804&: MkHTML = MkHTML + "&le;"
      Case 8805&: MkHTML = MkHTML + "&ge;"
      Case 8834&: MkHTML = MkHTML + "&sub;"
      Case 8835&: MkHTML = MkHTML + "&sup;"
      Case 8836&: MkHTML = MkHTML + "&nsub;"
      Case 8838&: MkHTML = MkHTML + "&sube;"
      Case 8839&: MkHTML = MkHTML + "&supe;"
      Case 8853&: MkHTML = MkHTML + "&oplus;"
      Case 8855&: MkHTML = MkHTML + "&otimes;"
      Case 8869&: MkHTML = MkHTML + "&perp;"
      ''' wrong / reused! Case 8870&: MkHTML = MkHTML + "&or;"
      
      Case 8901&: MkHTML = MkHTML + "&sdot;"
      Case 8968&: MkHTML = MkHTML + "&lceil;"
      Case 8969&: MkHTML = MkHTML + "&rceil;"
      Case 8970&: MkHTML = MkHTML + "&lfloor;"
      Case 8971&: MkHTML = MkHTML + "&rfloor;"
      Case 9001&: MkHTML = MkHTML + "&lang;"
      Case 9002&: MkHTML = MkHTML + "&rang;"
      Case 9674&: MkHTML = MkHTML + "&loz;"
      Case 9824&: MkHTML = MkHTML + "&spades;"
      Case 9827&: MkHTML = MkHTML + "&clubs;"
      Case 9829&: MkHTML = MkHTML + "&hearts;"
      Case 9830&: MkHTML = MkHTML + "&diams;"
      Case 0& To 9&
        MkHTML = MkHTML + "&#0" + CStr(xLong2) + ";"
      Case Else
        MkHTML = MkHTML + "&#" + CStr(xLong2) + ";"
      End Select
    Next
  End Function
