473,769 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Angle brackets cause string to truncate

I am trying to build an email address in PHP code using v5.1.2. All
works well until I try to surround the email address with angle
brackets. Every method I try causes the email address to disappear
completely. I have to believe that this is a common problem, but I
can't find any answers in the PHP docs or in Google. Any insight
would be greatly appreciated. Below are some of my failed attempts.

$strAddressee = "$ContactNa me "."<"."$Contact Email".">";
(brackets and email address disappear)

$strAddressee = "$ContactNa me <$ContactEmail> ";
(brackets and email address disappear)

$strAddressee = "$ContactNa me \074 $ContactEmail \076";
(works, except for unwanted spaces between the brackets and address)

$strAddressee = "$ContactNa me \074{$ContactEm ail}\076";
(brackets and email address disappear)

Apr 6 '07 #1
4 3966
>I am trying to build an email address in PHP code using v5.1.2. All
>works well until I try to surround the email address with angle
brackets.
Have you considered viewing the result in something other than HTML?
(or using the "view source" function of your browser?) I believe
the string really is there; you <dead catjust don't see it
<dead catin a browser <dead cat>. When you read this, how many
dead cats are there in the previous sentence? There are three.
>Every method I try causes the email address to disappear
completely. I have to believe that this is a common problem, but I
can't find any answers in the PHP docs or in Google. Any insight
would be greatly appreciated. Below are some of my failed attempts.

$strAddresse e = "$ContactNa me "."<"."$Contact Email".">";
(brackets and email address disappear)

$strAddresse e = "$ContactNa me <$ContactEmail> ";
(brackets and email address disappear)

$strAddresse e = "$ContactNa me \074 $ContactEmail \076";
(works, except for unwanted spaces between the brackets and address)

$strAddresse e = "$ContactNa me \074{$ContactEm ail}\076";
(brackets and email address disappear)
If you want to output this string on a web page and *only* on a
web page, try:

$strAddressee = "$ContactNa me &lt;$ContactEma il&gt;";

but if you put that in mail headers it will probably screw up.
Apr 7 '07 #2
Gordon Burditt wrote:
>I am trying to build an email address in PHP code using v5.1.2. All
works well until I try to surround the email address with angle
brackets.

Have you considered viewing the result in something other than HTML?
(or using the "view source" function of your browser?) I believe
the string really is there; you <dead catjust don't see it
<dead catin a browser <dead cat>. When you read this, how many
dead cats are there in the previous sentence? There are three.
>Every method I try causes the email address to disappear
completely. I have to believe that this is a common problem, but I
can't find any answers in the PHP docs or in Google. Any insight
would be greatly appreciated. Below are some of my failed attempts.

$strAddresse e = "$ContactNa me "."<"."$Contact Email".">";
(brackets and email address disappear)

$strAddresse e = "$ContactNa me <$ContactEmail> ";
(brackets and email address disappear)

$strAddresse e = "$ContactNa me \074 $ContactEmail \076";
(works, except for unwanted spaces between the brackets and address)

$strAddresse e = "$ContactNa me \074{$ContactEm ail}\076";
(brackets and email address disappear)

If you want to output this string on a web page and *only* on a
web page, try:

$strAddressee = "$ContactNa me &lt;$ContactEma il&gt;";

but if you put that in mail headers it will probably screw up.

or

$strAddressee = htmlspecialchar s("$ContactNa me <$ContactEmail> ");

Louise
Apr 7 '07 #3
Gordon Burditt wrote:
>I am trying to build an email address in PHP code using v5.1.2. All
works well until I try to surround the email address with angle
brackets.

Have you considered viewing the result in something other than HTML?
(or using the "view source" function of your browser?) I believe
the string really is there; you <dead catjust don't see it
<dead catin a browser <dead cat>. When you read this, how many
dead cats are there in the previous sentence? There are three.
>Every method I try causes the email address to disappear
completely. I have to believe that this is a common problem, but I
can't find any answers in the PHP docs or in Google. Any insight
would be greatly appreciated. Below are some of my failed attempts.

$strAddresse e = "$ContactNa me "."<"."$Contact Email".">";
(brackets and email address disappear)

$strAddresse e = "$ContactNa me <$ContactEmail> ";
(brackets and email address disappear)

$strAddresse e = "$ContactNa me \074 $ContactEmail \076";
(works, except for unwanted spaces between the brackets and address)

$strAddresse e = "$ContactNa me \074{$ContactEm ail}\076";
(brackets and email address disappear)

If you want to output this string on a web page and *only* on a
web page, try:

$strAddressee = "$ContactNa me &lt;$ContactEma il&gt;";

but if you put that in mail headers it will probably screw up.

if you wanted to write out the strAddressee as debug on an html page and
it had the angle brackets in, you would have to do:

echo htmlentities($s trAddressee);

That would encode the debug so you could see the angle brackets.
Apr 7 '07 #4
Have you considered viewing the result in something other than HTML?
(or using the "view source" function of your browser?) I believe
the string really is there; you <dead catjust don't see it
<dead catin a browser <dead cat>. When you read this, how many
dead cats are there in the previous sentence? There are three.
Nice catch Gordon! The address is there, just hidden. I was using
the browser to test the output, but the actual target is the mail()
function. It never occurred to me that the browser would interpret
the email address in brackets as an HTML tag. I guess what you see is
not always what you get. Thanks for your help, and thanks to the
other posters.

Apr 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
6738
by: Mxsmanic | last post by:
I have a line like this in some PHP code on my Web page: $callthis =~ s/<*>//g; When the page runs, I get this error: Parse error: parse error, unexpected '<' in /Feedback.php on line 145 So I presume I must escape angle brackets somehow in the regular expression. How do I do it? I tried putting a backslash in front of
5
3130
by: Darren Grant | last post by:
Hi there, I've attempted to implement an Angle class. An Angle is a subset of an integer, where the range is [0,360). All other operations should be permitted. The code works, I think... except (for example) a = b + 10; needs to be a = b + (Angle) 10; Could some kind soul comment on my code and show me how it could be
1
11691
by: bartek | last post by:
Hi, I'm aware that both quoted and angle-bracketed strings in an #include directive result in implementation-defined file lookup, differing in the fact that #include "foo.h" first checks *something* and then falls back to the same behaviour as #include <foo.h>. Now, in reality #include <foo.h> generally results in file name being checked up in explicitly specified locations (-I command line options, system header locations), while the...
2
4507
by: DotNetGruven | last post by:
We have a web service that returns a string which happens to be well formed XML. The client sees the string ok, except the angle brackets are HTML encoded ( &gt and &lt ). Is this expected behavior? Is there a way to configure it so that it doesn't do this? Currently, the client is being required to use HTML.decode() to fix it, but they would rather not?
29
3380
by: Vol | last post by:
I think 'atan' can get the angle but it is not the four quadrant angle. Is there any function that i can get the angle from -pi to pi? or I have to use some if ... else? I know in Matlab, we use 'atan2( )' Also, is there any function to get the round value, similar with floor and ceil, such like: round(3.1) = 3 round(3.6) = 4
2
2176
by: Kenneth Porter | last post by:
If you email your users links and wrap the links in angle brackets, beware users using Yahoo Mail. It includes the trailing angle bracket in the link, preventing it from working. (This was happening with my site's "forgotten password" system, so people couldn't reset their passwords.) As a workaround, you can have your code check for a trailing ">" and strip it before further processing. I submitted a bug report using Yahoo's generic bug...
2
4302
by: Peter | last post by:
Hi, I was wondering, can anyone tell me what statements in angle brackets are for in VB? For example, the default <System.Diagnostics.DebuggerStepThrough()thing that the IDE puts before the InitializeComponent method of a form.
4
7452
by: Keith Hughitt | last post by:
Hi all, I am using someone else's script which expects input in the form of: ./script.py <arg1arg2 I was wondering if the angle-brackets here have a special meaning? It seems like they specify an input and output stream to use in place of the console. I could not
6
2730
by: jeffg | last post by:
I have created a site that uses a Doctype of XHTML Transitional and a character set of utf-8, in case any of this matters. I have validated every page and cleaned up all errors. IE displays the pages fine but Firefox 3 puts a stray left angle bracket at the lower left corner of every page. I have used my dev tool to search my code for extra brackets and found nothing I have run out of options for what to analyze. Any suggestions of what...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.