You are currently browsing the monthly archive for December 2009.

Yeah, winters back.  Besides the really short days of sunlight I am really psyched.

I like to thank wordpress for the falling snow option to help all get in the spirit of the fun white fluffy stuff.

Sledding anyone?

I hacking together a report today and discovered the Unicode text I received was actually in Unicode not ASCII.  I remembered that ChrW(int) will convert character codes to their associated character.  I really wasn’t in the mood to write parsing logic and test it, but luckily I came across a class which does this.  I ripped out the method I needed and it worked great in all it’s simplicity.  I have included this function below:

Public Function UnicodeToASCII(sText As String) As String
  Dim saText() As String, sChar As String
  Dim sFinal As String, saFinal() As String
  Dim x As Long, lPos As Long

  If Len(sText) = 0 Then
    Exit Function
  End If

  saText = Split(sText, ";") 'Unicode Chars are semicolon separated

  If UBound(saText) = 0 And InStr(1, sText, "&#") = 0 Then
    UnicodeToASCII = sText
    Exit Function
  End If

  ReDim saFinal(UBound(saText))

  For x = 0 To UBound(saText)
    lPos = InStr(1, saText(x), "&#", vbTextCompare)

    If lPos > 0 Then
      sChar = Mid$(saText(x), lPos + 2, Len(saText(x)) - (lPos + 1))

      If IsNumeric(sChar) Then
        If CLng(sChar) > 255 Then
          sChar = ChrW$(sChar)
        Else
          sChar = Chr$(sChar)
        End If
      End If

      saFinal(x) = Left$(saText(x), lPos - 1) & sChar
    ElseIf x < UBound(saText) Then
      saFinal(x) = saText(x) & ";" 'This Semicolon wasn't a Unicode Character
    Else
      saFinal(x) = saText(x)
    End If
  Next

  sFinal = Join(saFinal, "")
  UnicodeToASCII = sFinal

  Erase saText
  Erase saFinal
End Function

This has driven me crazy for weeks, I just haven’t been able to access web_dav I setup at dreamhost.com.

I found a perfect article on how to do it at Geek Boy’s Blog.  It’s so simple,…

Make sure you add the port number to the url you provide for the network place.

E.g. http://www.mydomain.com:80/foo

Once I did that, I connected instantly.  No more need for third party apps, I can just access it. :)

Twitter Updates

Follow

Get every new post delivered to your Inbox.

Join 74 other followers