Author |
Topic  |
David K
Junior Member
 
494 Posts |
Posted - 03 December 2002 : 12:46:39
|
i need to convert emails to HTML for localization reasons, so I want to add a proccessing function to inc_mail.asp I want it to replace carridge returns and "vbNewLine" commands to a <br> html tags, I belive I can use rhe replace function, but what is the source character code? thank you |
|
Hamlin
Advanced Member
    
United Kingdom
2386 Posts |
Posted - 03 December 2002 : 17:23:23
|
chr(10)
So
theComment = Replace(theComment,Chr(10),"<br>",1,-1,1)
should do it. |
Edited by - Hamlin on 03 December 2002 17:25:10 |
 |
|
David K
Junior Member
 
494 Posts |
Posted - 03 December 2002 : 19:24:59
|
thanks |
 |
|
Gremlin
General Help Moderator
    
New Zealand
7528 Posts |
|
David K
Junior Member
 
494 Posts |
Posted - 04 December 2002 : 05:09:58
|
a vbNewLine command makes a CR, right? |
 |
|
Gremlin
General Help Moderator
    
New Zealand
7528 Posts |
Posted - 04 December 2002 : 05:26:48
|
Pretty sure its like this.
vbNewLine = chr(13) vbCRLF = chr(13) & chr(10) vbLF = chr(10) |
Kiwihosting.Net - The Forum Hosting Specialists
|
Edited by - Gremlin on 04 December 2002 05:28:54 |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 04 December 2002 : 07:37:42
|
Constant Value Description
vbCr = Chr(13) Carriage return.
VbCrLf = Chr(13) & Chr(10) Carriage return–linefeed combination.
vbFormFeed = Chr(12) Form feed; not useful in Microsoft Windows.
vbLf = Chr(10) Line feed.
vbNewLine = Chr(13) & Chr(10) or Chr(10)
Platform-specific newline character;
whatever is appropriate for the platform.
vbNullChar = Chr(0) Character having the value 0.
vbNullString String having value 0 Not the same as a zero-length string ("");
used for calling external procedures.
vbTab = Chr(9) Horizontal tab.
vbVerticalTab = Chr(11) Vertical tab; not useful in Microsoft Windows. |
 |
|
David K
Junior Member
 
494 Posts |
Posted - 05 December 2002 : 02:26:11
|
so how can I replace the vbNewLine calls for a "<br>" no matter what platform people are using? |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 05 December 2002 : 02:31:22
|
what's the difference between VbCrLf and vbNewLine? is it ok to change all vbNewLine to VbCrLf? hence solve possible problems when doing such a convertion? |
 |
|
Gremlin
General Help Moderator
    
New Zealand
7528 Posts |
Posted - 05 December 2002 : 02:46:28
|
quote: Originally posted by David K
so how can I replace the vbNewLine calls for a "<br>" no matter what platform people are using?
Well try Replace(myString,vbNewLine,"<BR>")
Once the users entered the input, its then down to what the server interprets as being a vbNewLine I guess.
my Suggestion would be to play around, setup a form here and ask a few people perhaps to enter some data and see what you end up with. |
Kiwihosting.Net - The Forum Hosting Specialists
|
Edited by - Gremlin on 05 December 2002 02:51:29 |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 05 December 2002 : 03:39:04
|
fString = Replace(fString, CHR(13), "") 'fString = Replace(fString, CHR(10) & CHR(10), "<br /><br />") fString = Replace(fString, CHR(10), "<br />")
this is what in function FormatStr |
 |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 05 December 2002 : 06:35:00
|
quote: Originally posted by bjlt
what's the difference between VbCrLf and vbNewLine? is it ok to change all vbNewLine to VbCrLf? hence solve possible problems when doing such a convertion?
VBNewLine is NOT platform specific, so depending on the servers OS it will write a different value.
YOU SHOULD ALWAYS USE VbNewLine, since sending a vbCrLf will not result in the correct eol markers on all platforms |
 |
|
Gremlin
General Help Moderator
    
New Zealand
7528 Posts |
Posted - 05 December 2002 : 06:48:46
|
Actually we are talking about receiving not sending vbNewLines.
I'm not sure I understand your first sentance there Huw (could be just thats its the middle of the morning). It seems to contradict itself..... It's not platform specific, but depending on the server you'll get a different value ? |
Kiwihosting.Net - The Forum Hosting Specialists
|
Edited by - Gremlin on 05 December 2002 06:50:51 |
 |
|
David K
Junior Member
 
494 Posts |
Posted - 05 December 2002 : 08:06:34
|
Thank you everybody, I've succeded admirably! here's the code I used to encode all emails to HTML (in inc_mail.asp): dim HTMLMsg dim strTmp strTmp = strMessage HTMLMsg = "<html DIR=""RTL"">" & vbNewLine & "<body>" HTMLMsg = HTMLMsg & FormatStr(strTmp) HTMLMsg = HTMLMsg & "</body></html>"
I needed it to support alignment of messages and links in Hebrew (ISO-8895-I) encoded emails |
 |
|
Gremlin
General Help Moderator
    
New Zealand
7528 Posts |
Posted - 05 December 2002 : 08:23:08
|
Glad ya got something out of our collective ramblings then ;) |
Kiwihosting.Net - The Forum Hosting Specialists
|
 |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 05 December 2002 : 09:36:44
|
if you used vbCRLF to write a file to a unix server it would not understand the EOL markers correctly so it IS platform specific, vbNewLine on the other hand would write the correct value so it is NOT platform specific
ie NOT platform specific means you can use it on ANY platform |
 |
|
Topic  |
|