[sf-perl] Printing TM trademark symbol in perl

Richard Reina gatorreina at gmail.com
Thu Feb 9 12:42:15 PST 2012


$msg->attr('content-type.charset' => 'UTF-8');

Did the trick! Now it works without a hitch.  Thank you so much for all the
help.  My long day of frustration is finally over.

Thank you again!  Have a great day!!!

2012/2/9 Francisco Obispo <fobispo at isc.org>

> One more thing.
>
> Add the attribute charset like this:
>
>
> my $msg = MIME::Lite->new(
>   From    => 'francisco at obispo.com.ve',
>  To      => 'fobispo at isc.org',
>  #Cc      => 'gatorreina at gmail.com, loads at rushlogistics.com',
>   Subject => 'Test TM mark',
>   Data    => $body,
>  Type     =>'text/plain'
>
> );
>
>
> $msg->attr('content-type.charset' => 'UTF-8');
>
>
>
> On Feb 9, 2012, at 2:39 PM, Richard Reina wrote:
>
> > I can' find any good documentation for this.  Here is my code can you
> tell me what I am doing wrong?
> >
> > use strict;
> > use MIME::Lite;
> > use Encode;
> >
> > my $body = ' TEST TM ™';
> >
> > my $msg = MIME::Lite->new(
> >         From     =>'ar at rushlogistics.com',
> >         To       =>'richard at rushlogistics.com, loads at rushlogistics.com',
> >         Cc       =>'gatorreina at gmail.com, loads at rushlogistics.com',
> >         Subject  =>'Test TM mark',
> >          Data => encode_utf8("utf8", $body),
> >         #Type     =>'multipart/mixed';
> >                   );
> >
> >
> >
> > 2012/2/9 Francisco Obispo <fobispo at isc.org>
> > use Encode;
> >
> > Then:
> >
> > encode_utf8
> >
> > Remember to set the character set
> >
> > Francisco
> >
> > On Feb 9, 2012, at 1:08 PM, Richard Reina <gatorreina at gmail.com> wrote:
> >
> >> I tried but when I do:
> >>
> >>   Data => encode("utf8", $body),
> >>
> >> I get:
> >>
> >> Undefined subroutine &main::encode called at test_MIME_mail.pl line 8.
> >>
> >> 2012/2/9 Francisco Obispo <fobispo at isc.org>
> >> Ah!,
> >> well, just make sure you set your quoted-printable and UTF-8, you might
> want to read:
> >>
> >>
> http://www.databasesandlife.com/using-utf-8-and-unicode-data-with-perl-mimelite/
> >>
> >> regards,
> >>
> >>
> >>
> >>
> >> On Feb 9, 2012, at 12:50 PM, Richard Reina wrote:
> >>
> >> > Thanks for the replies.  I think we're getting down to the crux of
> the issue.  Ultimately, what has to happen is that I have to get the ™ into
> text emails that our sent out by a script using mime::lite.  This is
> proving to be daunting for me any help would be greatly appreciated.
> >> >
> >> >
> >> > 2012/2/9 Dodger <el.dodgero at gmail.com>
> >> > Moreover even if he changes the character set so it displays right in
> his viewer or editor, if that file is supposed to be used by someone else
> in a different environment that may expect a different charset it won't
> work.
> >> >
> >> > Perl can't help that. About the only way around it is using some
> format like XML in which the character set can be explicitly specified.
> >> >
> >> > Sent from my iPhone
> >> >
> >> > On 09/02/2012, at 9:26 AM, Francisco Obispo <fobispo at isc.org> wrote:
> >> >
> >> > > exactly.
> >> > > It's how you interpret it, as long as it is the right character.
> >> > >
> >> > > Francisco
> >> > >
> >> > >
> >> > > On Feb 9, 2012, at 12:22 PM, Dodger wrote:
> >> > >
> >> > >> It seems to me the problem isn't printing any given character into
> a file but, rather, whatever is being used to display the file not
> rendering the right character.
> >> > >>
> >> > >>
> >> > >> Sent from my iPhone
> >> > >>
> >> > >> On 09/02/2012, at 8:35 AM, Francisco Obispo <fobispo at isc.org>
> wrote:
> >> > >>
> >> > >>> you need to check your encoding to make sure that they match, and
> if they don't set them properly.
> >> > >>>
> >> > >>> LANG="en_US.UTF-8"
> >> > >>>
> >> > >>> or any other UNICODE-compatible encoding.
> >> > >>>
> >> > >>> It is generally a bad idea to rely on it because it if clients
> don't understand UNICODE they will see whatever character correspond to
> their table… and believe me, it's even worse when the client doesn't
> support multi-byte characters (in general).
> >> > >>>
> >> > >>> Francisco
> >> > >>>
> >> > >>> On Feb 9, 2012, at 8:27 AM, Richard Reina wrote:
> >> > >>>
> >> > >>>> Hi Franisco, Your suggestion as well as print chr('8482') works.
>  However, it only works on my Ununtu Machines that are running Xwindows.
>  When I try it on a Centos machines in console mode it prints the circled
> "r" for registered trademark.  Would anyone know why this is and how to get
> the TM to print on a Centos machine?
> >> > >>>>
> >> > >>>>
> >> > >>>>
> >> > >>>> 2012/2/8 Francisco Obispo <fobispo at isc.org>
> >> > >>>> Actually in UTF-8 its: 8482
> >> > >>>>
> >> > >>>>
> >> > >>>> perl -e 'use Encode; map { printf(qq{char %d is:
> %s\n},$_,encode_utf8(chr($_)))} (8482)'
> >> > >>>>
> >> > >>>>
> >> > >>>> http://www.fileformat.info/info/unicode/char/2122/index.htm
> >> > >>>>
> >> > >>>>
> >> > >>>>
> >> > >>>>
> >> > >>>>
> >> > >>>> On Feb 8, 2012, at 6:42 PM, Francisco Obispo wrote:
> >> > >>>>
> >> > >>>>> I was hoping it would show up in the table.
> >> > >>>>>
> >> > >>>>>
> >> > >>>>>
> >> > >>>>> On Feb 8, 2012, at 6:36 PM, Richard Reina wrote:
> >> > >>>>>
> >> > >>>>>> I don't know whether it is or not. I was hoping it was because
> I have to find a way to print it.
> >> > >>>>>>
> >> > >>>>>> 2012/2/8 Jeff Bragg <jackofnotrades at gmail.com>
> >> > >>>>>> Is that actually in the ASCII set?  I see (in the output from
> a for loop printing the characters for ordinals 10 - 255) the circled 'r'
> (ord 174) and the copyright symbol (ord 169), but no trademark symbol.
> >> > >>>>>>
> >> > >>>>>> 2012/2/8 Richard Reina <gatorreina at gmail.com>
> >> > >>>>>> I am needing to print the TM symbol for a trademark into a
> regular ascii text file and having no luck doing so.  Does anyone know how?
> >> > >>>>>>
> >> > >>>>>> Thanks for any help.
> >> > >>>>>>
> >> > >>>>>> _______________________________________________
> >> > >>>>>> SanFrancisco-pm mailing list
> >> > >>>>>> SanFrancisco-pm at pm.org
> >> > >>>>>> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
> >> > >>>>>>
> >> > >>>>>>
> >> > >>>>>>
> >> > >>>>>> _______________________________________________
> >> > >>>>>> SanFrancisco-pm mailing list
> >> > >>>>>> SanFrancisco-pm at pm.org
> >> > >>>>>> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
> >> > >>>>>
> >> > >>>>> _______________________________________________
> >> > >>>>> SanFrancisco-pm mailing list
> >> > >>>>> SanFrancisco-pm at pm.org
> >> > >>>>> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
> >> > >>>>
> >> > >>>>
> >> > >>>
> >> > >>> _______________________________________________
> >> > >>> SanFrancisco-pm mailing list
> >> > >>> SanFrancisco-pm at pm.org
> >> > >>> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
> >> > >
> >> >
> >>
> >>
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20120209/197a3e3d/attachment-0001.html>


More information about the SanFrancisco-pm mailing list