OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

dispatcher mailto German 'Umlaute'

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
verflixtnix
Power User
Power User


Joined: 11 May 2004
Posts: 79
Location: Germany, Hamburg

PostPosted: Wed Jun 30, 2004 4:03 am    Post subject: dispatcher mailto German 'Umlaute' Reply with quote

Hi,

I've got the german OOo1.1.2 and generally have no problems with 'Umlaute' or other 'special' chars.
Now, I wanted to use the dispatcher function 'mailto' for sending an email with body.
The bodystring contains contact data with 'Umlaute' (ä,ö,ü etc and ß).

If I Display the string in a message box, everthing is fine, if use the 'mailto'-dispatcher function, I get something like
Quote:
Hüppelux
Fantasiestraße 999
98765 Güstrow

instead of:
Quote:
Hüppelux
Fantasiestraße 999
98765 Güstrow


My code:
Code:

Sub declareMailAttributes
   sRecipient = "trillian@world.universum"
   sSubject = "no panic"
   sBody = "Es grünt so weiß, der Ödipus über der Straßenbahn"
   exampleSendEmailWithBody(sRecipient, sSubject, sBody)
End Sub

Sub exampleSendEmailWithBody(sRecipient As String, sSubject As String, sBody As String)
   email_dispatch_url = "mailto:" & sRecipient & "?subject=" & sSubject & "&Body=" & sBody
   Dim noargs()

   dispatcher = createUnoService( "com.sun.star.frame.DispatchHelper")
   dispatcher.executeDispatch( StarDesktop,email_dispatch_url, "", 0, noargs() )   
End Sub

Does somebody know a way to fix this?
_________________
Jan Lüdtke

SuseLinux9.0 - OOo1.1.2 / Win2000 - OOo1.1.2
Back to top
View user's profile Send private message
verflixtnix
Power User
Power User


Joined: 11 May 2004
Posts: 79
Location: Germany, Hamburg

PostPosted: Wed Jun 30, 2004 5:18 am    Post subject: Reply with quote

In case, there is no other solution, then to substitute the 'special' chars...
Code:

Function replaceSpecialChar(sSomeString)
   
   restartSearch:
   
   vStringLength = len(sSomeString)

      For i = 1 to vStringLength
         sChar = mid(sSomeString,i,1)
         If sChar = "ä" Then
            sSomeString = returnUpdatedString(sSomeString, vStringLength, i, "ae")
            goto restartSearch
         ElseIf sChar = "Ä" Then
            sSomeString = returnUpdatedString(sSomeString, vStringLength, i, "Ae")
            goto restartSearch
         ElseIf sChar = "ö" Then
            sSomeString = returnUpdatedString(sSomeString, vStringLength, i, "oe")
            goto restartSearch
         ElseIf sChar = "Ö" Then
            sSomeString = returnUpdatedString(sSomeString, vStringLength, i, "Oe")
            goto restartSearch
         ElseIf sChar = "ü" Then
            sSomeString = returnUpdatedString(sSomeString, vStringLength, i, "ue")
            goto restartSearch
         ElseIf sChar = "Ü" Then
            sSomeString = returnUpdatedString(sSomeString, vStringLength, i, "Ue")
            goto restartSearch
         ElseIf sChar = "ß" Then
            sSomeString = returnUpdatedString(sSomeString, vStringLength, i, "ss")
            goto restartSearch
         End If
      Next i
   
   replaceSpecialChar = sSomeString
   
End Function

Function returnUpdatedString(sTempString As String, iLength As integer, iCount as integer, sSubst as String)

   sStringTail = right(sTempString, iLength - iCount)
   sStringHead = left(sTempString, iCount - 1)
   returnUpdatedString = sStringHead & sSubst & sStringTail
   
End Function


I feed the function 'replaceSpecialChar' with my string and get a readable body, when I use the dispatcher 'mailto:'
_________________
Jan Lüdtke

SuseLinux9.0 - OOo1.1.2 / Win2000 - OOo1.1.2
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group