JSP for Vcard cannot strip carriage return in the last line of the file.

I am using JSP to output a Vcard (http://en.wikipedia.org/wiki/VCard)
The following code works great in Windows but fails on the mac:
<%@ page contentType="text/x-vcard" %><%--
--%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--
--%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %><%--
--%>BEGIN:VCARD
VERSION:2.1
<c:choose><%--
--%><c:when test="${not ((empty param.lan) and (empty param.fin)) }"><%--
--%>N:${param.lan};${param.fin}
FN:${param.fin} ${param.lan}
</c:when><%--
--%><c:otherwise><%--
--%>FN:${param.org}
</c:otherwise><%--
--%></c:choose><%--
--%>ORG:${param.org}
TITLE:${param.title}
TEL;WORK;VOICE:${param.phwork}
ADR;WORK:;;${param.st};${param.city};${param.state};${param.zip};
EMAIL;PREF;INTERNET:${param.email}
REV:20080424T195243Z
<c:out value="${fn:replace('END:VCARD','\\\r','')}" escapeXml="false"/>After some tests, I discovered that Mac (I used Tiger, latest update, not Leopard) needs extra white space and carriage returns stripped off. Once this is achieved, the vcard will automatically import into Address Book. I have followed other forums which advice on using JSP comments as in the code above. But for some strange reason the last line of the JSP outputs an extra carraige return. How do I get rid of the carriage return at the end of the file? the replace function from JSTL is not working.
Edited by: shogo2040 on Dec 18, 2008 7:11 PM : I added more detail to the Subject

I originally had that END:VCARD without any carriage return.
But I still get an extra carriage return at the end when the JSP renders to VCF
I'm using Tomcat running on Linux.
I found this, article which implies (but does not explicitly say) JSP in general adds a newline to the last line:
http://www.caucho.com/resin-3.0/jsp/faq.xtp (But its not tomcat either, so maybe this info is irrelevant).
Edited by: shogo2040 on Dec 22, 2008 3:31 PM - changed rendered to VCF from rendered to JSP

Similar Messages

  • Default Carriage return in the last column when data is downloaded to Excel

    Problem:
    When you download data into Excel and if the last column of your excel is a numeric field, XMLP will add a carriage return (special character) to your numeric field. This feild will be considered as character field by excel.
    Work Around:
    When you build the template, create an empty column as your last column and leave E (or end-for-each) in that empty column.
    Note:
    If the last column is a character column then you do not have to do this.

    I originally had that END:VCARD without any carriage return.
    But I still get an extra carriage return at the end when the JSP renders to VCF
    I'm using Tomcat running on Linux.
    I found this, article which implies (but does not explicitly say) JSP in general adds a newline to the last line:
    http://www.caucho.com/resin-3.0/jsp/faq.xtp (But its not tomcat either, so maybe this info is irrelevant).
    Edited by: shogo2040 on Dec 22, 2008 3:31 PM - changed rendered to VCF from rendered to JSP

  • Cd() prints a carriage return to the screen

    In writing scripts, I've noticed that the cd() method echoes an extra carriage
    return to the terminal. Due to the fact that set() is context-specific (can't
    say cmo.set(); must say set() instead), long scripts have a lot of calls to cd(),
    and so the user sees lots of blank lines when running the scripts.

    Justin,
    Thanks for reporting this. It will be corrected in the next release.
    -satya
    Justin Dossey wrote:
    In writing scripts, I've noticed that the cd() method echoes an extra carriage
    return to the terminal. Due to the fact that set() is context-specific (can't
    say cmo.set(); must say set() instead), long scripts have a lot of calls to cd(),
    and so the user sees lots of blank lines when running the scripts.

  • Cannot preview filetype please download the file for viewing and garbled text on a downloaded image

    Dear Madam or Sir,
    When I click on a file titled "Subject Access Request Letter re Account Number 12527629 Sort Code 60-10-34 24022015.pdf", which is stored in my Account on Acrobat.com I get the response "Cannot preview filetype please download the file for viewing". This file was created from an OpenOffice .odt document of the same title. Please advise.
    I downloaded an image, which purports to be a .pdf, from the Royal Mail Track & Trace web facility using my Samsung S5. The text that I expect to see might as well be hieroglyphics for all its similarity to text. Please advise.
    Regards,
    Ron Platt
    PS I have tried to attach both files (.pdf) but am advised "That image type is forbidden". Please advise.

    Hi Laura,
    I have found the solution to be:
       1. Not to upload to "Document Cloud" from the .pdf stored on my PC and
       open on screen.
       2. To login to Acrobat.com from the .pdf stored on my PC and open on
       screen, select "Document Cloud" and the sub-folder required and then upload
       the file
    I have a feeling that there is a glitch somewhere, because after I have
    opened a number of .pdf files stored on my PC, and irrespective of whether
    I have closed them prior to opening the next .pdf file or left them open,
    Acrobat Reader will display (Not responding) in the window title bar. The
    "number of files" equates to less than 10. I, then, click on the X at the
    right of the window title bar and I am given the option of "Close the
    program" or "Wait until the program responds" (or words to that effect). If
    i choose the latter, nothing happens and I am back at the unhappy status
    quo. If I choose the former, I am told that Windows is searching for a
    solution, which it never finds. I, then, have to shut down the PC and then
    start it up, again. Clicking "Restart" does not solve the problem.
    I have described the above before and received the usual "it cannot be
    Acrobat, it is perfect" response. I could, I suppose, screenshot/snip every
    sequential screen but why should I have to when I have described the
    sequence as fully as I can. So I have found a "workaround" that does not
    solve the "Not responding" problem but does solve the problem of not being
    able to upload from the open .pdf file to the sub-folder in "Document
    Cloud". I am, on occasion, working through the myriad of .pdf files that
    are in the root folder of "Document Cloud" and putting them in the correct
    sub-folder(s).
    I have today read that Google is starting a cellphone service in the USA in
    which a monthly "access" rental (US$20) is paid plus a GB capacity usage is
    elected for at a rate specified, e.g. US$10.00/GB. If the subscriber  does
    not use the elected GB capacity Google refunds the US$value of the unused
    elected GB capacity.
    Suggestion: Adobe applies that kind of policy to its online software
    package usage rates, e.g. I elect to subscribe to a particular level of
    online software package usage monthly, but, if I do not use all of the
    programs included in that online software usage package, I am credited back
    for not having used the softwares, that I did not use, that were inclusive
    in that online software package offer.
    Regards,
    Ron

  • Using `n how can i add two empty line (two carriage return), between these two lines in the output file?

    hi friends
    using `n   how can i add two empty line (two carriage return), between these two lines in the output file?
    PS C:\> $env:COMPUTERNAME | add-content c:\file.txt
    PS C:\> $Env:USERDOMAIN  | add-content c:\file.txt
     i tested "$env:computername`n`n`n$env:userdomain" | add-content c:\file.txt   but it results in 
    myPCMyDomain
    but i wanted the contents of the output file be like this:
    MyPC
    #empty line here 
    #empty line here
    MyDomain
     i tested many other forms but didn't work.
    thanks

    I tried it, as well. The line breaks were respected in the PowerShell console, Programmer's Notepad, and Word; they weren't in Notepad.
    You are using a Unicode file.  Locale is what?
    If you just want notepad compatible line breaks then do this:
    del file.txt ; "$env:computername`r`n`r`n`r`n$env:userdomain" | add-content file.txt ;notepad file.txt
    Look in hex to see that `n is ^L or 0xA and is only one character.  CrLf is 0xD 0xA - two characters.
    My programmers editors and VS all understand a single ^L as a line break so does PowerShell.  Only DOS/Notepad and other utilitis don't understand this..
    ¯\_(ツ)_/¯

  • The Microsoft Access database engine cannot open or write to the file \\fileserver\db\access.mdb

    Hi,
    I have Windows Server 2012 with SQL 2012 Standard SP1. I am using linked server, and Access Database Engine 2010 Redistributable to access my database file made in Microsoft Access (.mdb) from network file server.
    EXEC master.dbo.sp_addlinkedserver @server = N'MyLinkedServer', @srvproduct=N'MyLinkedServer', @provider=N'Microsoft.ACE.OLEDB.12.0', @datasrc=N'\\myfileserver.mydomain.com\files\mydatabase.mdb'
    My SQL service is running with domain service account MYDOMAIN\SQL1$ , i have added Full control for file share and NTFS permission on my file server folder (C:\Files).
    When I open (as domain admin with UAC elevated permissions) on my DB server SQL Management studio, I can browse tables and everything works.
    The problem is, if I open SQL management studio (as domain admin with UAC elevated permissions) on my File server or any other computer, when trying to browse my linked server i got error:
    TITLE: Microsoft SQL Server Management Studio
    Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "Synesis_3PRO2013". (Microsoft SQL Server, Error: 7303)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.00.3000&EvtSrc=MSSQLServer&EvtID=7303&LinkId=20476
    When I try to place simlpe Select SQL query I got error:
    OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "MyLinkedServer" returned message "The Microsoft Access database engine cannot open or write to the file '\\myfileserver.mydomain.com\files\mydatabase.mdb'. It is already opened exclusively by another
    user, or you need permission to view and write its data.".
    I do not have any other program using my access database, and user has full control. I am trying to use in security mode - "For a login not defined in the list above, connections will be made without using a security context", i have also tried all four options.
    I am confused becouse it works from SQL server but from any SQL client domain member computer/server it does not work.
    I have same problem in another environment where I have Windows Server 2008 R2 and SQL 2008 R2 SP2.
    Please help.
    -- Hrvoje Kusulja

    NTFS must be fine since it works from same server using same accounts.
    As I understand, adding my access file to Access trusted location could be a problem. I have tried now to add my access database file location to trusted locations for user which is my SQL service user (Windows Service - AD managed service account MYDOMAIN\SQL1$)
    and my test user which I use to connect to sql server as a client from sql management studio. (Account is Domain Admins and have full permissions on SQL server also)
    I have added this .reg:
    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security]
    [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Documents]
    "LastPurgeTime"=dword:01592874
    "DisablePromptOpenNetworkTrustedDocuments"=dword:00000000
    [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations]
    "AllowNetworkLocations"=dword:00000001
    [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations\Location0]
    "Description"="My file server"
    "AllowSubFolders"=dword:00000001
    "Path"="\\\\myfileserver.mydomain.com\\files\\"
    I have done this for SQL service account user and my personal test account as I said. I have tried to logoff and restart sql service and all servers also.
    The same problem still persists.
    Anyway, thank you for giving me a hint.

  • I saved my Form Central spreadsheet file once as a excel file but it will not allow me to save it a second time as an excel file.  It says that I cannot complete this action because the file me be open in another application, but it is not open in another

    I saved my Form Central spreadsheet file once as a excel file but Forms Central will not allow me to save the file a second time as an excel file.  I am informed that I cannot complete this action because the file me be open in another application, but it is not open in another application. What is the problem, and how do I solve the problem.  Thank you. Jeff

    First check the version of the document with Jongware's script "Identify.jsx" (ExtendScript/JavaScript).
    You can find it here:
    [Ann] Identify Your InDesign File
    If it is CS 5.5 or above, you need someone to open it in the version the script says and export an IDML representation from that. Another way would be to install a 30days version of CS6 or above (CC) and do it yourself.
    In regards of the script showing a result for InDesign files higher than CS6:
    CS7 = CC v9
    CS8 = CC v10 = CC-2014 or CC2014.1
    Uwe

  • Need UCM service which has  to return all the files in the Folder

    HI,
    I need a webservice which has to return all the images/text files in the folder. I ll pass folder name has a input parameter..once i got all the files i have to shown those images in the web page.
    Do we have any service with this requirement?? Or
    i have to use 'Seach' service ,Which has return all the files meta info ...with this info do i have to use GetFile service for displaying data??
    Any suggestions??
    Thanks

    Hi Jiri,
    I dont know abt folios..I ll go thru it now..
    When coming to the option a)
    When we are calling Search service it will return resultset which contains meta data(Filename,File Id,URL,etc.....) for list of files in the folder. Now what i do to display image is , using this URL i ll bulid image object using this URL and i ll display it on the webpage(This web page contains Silver light component to display these images.)
    I m assuming problem with this one is every time when i m building image i m hitting the the server to construct the image. Instead im trying to get the all the images in one shot when i pass folder name??
    I doubt myself wether my assumtion is correct or not...
    any suggestions plz..
    Thanks

  • Cannot save ... The file has been changed by another application.

    Hi,
    This is to report a wierd behavior when pages is auto saving documents.
    An error pops up  "Cannot save ... The file has been changed by another application."
    Clicking "save anyways" seems to save the document OK, but still this is very anoying.
    Saving the document manually (from the menu) isn't showing any error message.
    Can someone help with a hint as of when this will be fixed or is there a workaround?
    Thank you in advance,
    Best Regards,
    Michel.
    Pages version 5.0.1 (1478) on OS X 10.9

    The phrase "by another application" makes it pretty clear that it is not Pages (or, in your case, Keynote).
    What seems to be happening is that between the time that Pages opens a document, or saves it and the next time that it attempts to save it, something updates the document's file on the hard drive. Pages, recognizing that the file contains changes for which it is not responsible, presents this alert so you can decide whether you want to overwrite those changes. The usual suspects are backup and synchronization applications, like iCloud, which may not recognize the "Open" flag on the file, but I think it can also be triggered by AppleScripts, Automator workflows and Services, if they perform a "Save" action on the file.

  • The Microsoft Access database engine cannot open or write to the file in Report Builder 3.0

    I am trying to build a report in Report Builder 3.0.  I created the Data Source to point to my Excel file and the Data Set.  I drag a couple of fields on to the canvas and then choose Run.  I get the error:  "The Microsoft Access
    database engine cannot open or write to the file.  It is already opened exclusively by another user".  I am using the Excel driver.  Why am I getting this message?  How can I fix this?

    No, now I am getting the error message again.  It is quite long:
    ERROR [HY000] [Microsoft][ODBC Excel Driver] The Microsoft Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view and write its data.
    ERROR [01S00] [Microsoft][ODBC Excel Driver]Invalid connection string attribute Trusted_Connection
    Please help

  • When I try to open large files that i have created (1.2 gb to 1.5 gb) the ram usage for Photoshop climbs to 4 gb and the file will not open.

    I am using PS 12.1 x64 on a Windows 7 64 bit pc.when I try to open large files that i have created (1.2 gb to 1.5 gb) the ram usage for Photoshop climbs to 4 gb and the file will not open

    Machine specs, please.  Totallinstalled RAM, scratch disk space, etc
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand, such as your platform (Mac or Win), exact versions of your OS, of Photoshop and of Bridge, machine specs, what troubleshooting steps you have taken so far, what error message(s) you receive, if having issues opening raw files also the exact camera make and model that generated them, etc., someone may be able to help you.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Contribute strips carriage return from javascript

    Hi
    Has anyone had a problem where carriage returns are stripped from javascript by Contribute?
    If the code is
    <script>
    <!--
    script here
    //-->
    </script>
    It ends up as
    <script><!--script here//--></script>
    and it doesn't run because it is all commented out.
    Does anyone have a solution apart from removing the comment code?
    Administration of the site Editing setting is set to "Allow unrestricted editing" with "Protect scripts and forms" checked.

    Thanks. I finally got it to work.
    Doing the replace on the original page still got stripped. It didn't like chr(10) or chr(13). It did find /n though.
    I had to trigger a function to globally replace all the /n's with dummy text. Then, on the popup page, I had to create a function to globally replace the dummy text with /n's; and trigger in Footer section.
    What a pain, just to end up with you already had in the 1st place. lol

  • Write to Binary File strips carriage returns (LV 8.2.1)

       I was using Write to Binary File to write a combination of strings, numbers, and time stamps.  When I later went to read the filel, it didn't quite make sense.  Although I had written strings that had lines ending in <CR><LF>, when I read them back in, they only had <LF>.  I checked this using other programs to read the file.  The <CR>'s have been stripped out!  Why would a "binary" file VI kindly edit your strings for you?  I needed the strings to be written exactly as they were.  The VI corrupted my data.
       I couldn't find any explanation for this in the help, nor any way to turn this behavior off.  Is this a known issue, a bug, or a feature?
    Regards,
       Dave T.
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

       Thanks, Altenbach and Jarrod, for your help.
       Time to eat crow.  At Altenbach's prompting, I created a sample program that would demonstrate the problem.  It didn't.  Turns out the files were fine.  I was reading them with the "Read from Text File" vi, with the EOL option enabled!  I had used another program to check the data in the file, and was basing my conclusion on that.  Unfortunately, I didn't use a good hex editor, and it turns out the program I used was also stripping the <CR> off.  So the data in the file was good, I was reading it wrong, and my double-check was reading it wrong.
    Cheers,
        Dave
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

  • IgnoreWhite doesn't strip carriage returns?

    I have read in many resources that ignoreWhite gets rid of
    all carriage returns. Yet, when I run this simple example, I see a
    visible carriage return (2 in fact) in the output panel. What is
    going on here?
    XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <portfolio>
    <section sectionName="signature">
    <content filename="filename.swf" caption="hello">
    This is the text that goes in here.
    </content>
    </section>
    </portfolio>
    ActionScript:
    var myXML:XML = new XML();
    myXML.ignoreWhite = true;
    myXML.onLoad = function (success:Boolean):Void {
    if (success) {
    trace(this);
    else {
    trace("Error loading XML file");
    myXML.load("portfolio.xml");
    Here is a screen shot of the output panel:
    http://www.thinkseed.com/test/ignoreWhite_output.gif

    Two things seem to solve this problem:
    Adding a CDATA tag to the XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <portfolio>
    <section sectionName="signature">
    <content filename="filename.swf" caption="hello">
    <![CDATA[This is the text that goes in here.]]>
    </content>
    </section>
    </portfolio>
    Or just simply getting rid of the carriage returns:
    <?xml version="1.0" encoding="UTF-8"?>
    <portfolio>
    <section sectionName="signature">
    <content filename="filename.swf" caption="hello">This
    is the text that goes in here.</content>
    </section>
    </portfolio>

  • How do I add a carriage return to the output ?

    I have a listBox with 15 values. That list box is connected to a textBox. The text box prints only the selected items from the listBox (thanks try67 for the help getting that set up). Now what I would like to do is have each of the items that are selected to appear seperately in lieu of having one lone continuous line. I think what I need to do is add a carriage returne (or two) between each item selected. Here is the code I have for custom calculation script
    var v = this.getField("DiagnosisList").value;
    if (typeof v=="string") event.value = v;
    else event.value = v.join(", ");
    I triend adding  /r/n   but I keep geting syntax error. Thanks for any assistane.

    I appreciate you assistance, but this is not going to work. The narrative on the listBox for each item is so large, that it either gets chopped off or if I set the text size to auto it is too small. Is there a way to display the list items in a format that 'wraps'? If not then I will neet to set it up with check boxes now, but here is how the format should work:
    () item one
    () item two
    () item three
    then allow certain ones to be checked,
    (x) itme one
    () item two
    (x) item three
    and based on the ones checked, those are the only ones that print
    Item one.
    Item two.

Maybe you are looking for