Are you using the input.encoding or output.encoding properties at all? I don't do much with encodings, so i'm no expert, but have you read these? http://velocity.apache.org/engine/devel/developer-guide.html#template_encoding_for_internationalization http://velocity.apache.org/engine/devel/developer-guide.html#velocity_configuration_keys_and_values (see especially the Character Encoding section of the latter)
Also, have you searched the mailing list archives? http://velocity.markmail.org/search/?q=encoding And if you are using it, i've often heard UTF-8 recommended to people: http://velocity.markmail.org/search/?q=encoding+UTF-8 On Dec 12, 2007 8:50 AM, Sébastien PIERREL <[EMAIL PROTECTED]> wrote: > > HI,I'm working on a JSF application with Velocity which I use for email > sending in text, not in HTML. I have some problems with accentuated > characters (à, é, è ...) or specials characters in general (€ for example). I > use some java to get the content of the email like this: public String > getCorpsClient(RecapitulatifCommandeDTO recapCmd, String cid) { String > getCorps = "getCorps : "; String pCorps = null; configure(engine); Template > template; try { template = engine.getTemplate(buildFileName(FILE_RECAP_CMD, > recapCmd)); VelocityContext context = createContext(); > context.put(VAR_RECAP_CMD, recapCmd); context.put(VAR_CID, cid); StringWriter > writer = new StringWriter(); template.merge(context, writer); pCorps = > writer.getBuffer().toString(); writer.close(); } catch > (ResourceNotFoundException rnfe) { logger.error(getCorps + rnfe); throw new > TechnicalException(noTemplateVelocity, rnfe); } catch (ParseErrorException > pe) { logger.error(getCorps + pe); throw new > TechnicalException(parseErrorTemplateVelocity, pe); } catch (Exception e) { > logger.error(getCorps + e); throw new > TechnicalException(techExceptionVelocity, e); } return pCorps; } My function > which send the email. I've tested many values for ENCODAGE without any > changes.public boolean sendHtmlEmailOubliPassWord(String toMail, String > toName,String fromMail, String fromName, String subject, String corps) > {boolean result = false;Session session = getMailSession();SimpleEmail email > = new SimpleEmail();email.setMailSession(session);email.setSentDate(new > Date());email.setCharset(ENCODAGE);try {email.addTo(getMockEmail(toMail), > toName);email.setFrom(fromMail, > fromName);email.setSubject(subject);email.setMsg(corps);email.send();result = > true;} catch (EmailException ee) {logger.error("Erreur sendSimpleMail : " + > ee + "\n"+ ee.getCause());}return result;}My velocity.properties if it can > help:resource.loader = classclass.resource.loader.description = Velocity > Class Resource Loaderclass.resource.loader.class = > org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader# Cette > partie n'est pas utilis?(pas r?renc?dans > resource.loader)file.resource.loader.description = Velocity File Resource > Loaderfile.resource.loader.class = > org.apache.velocity.runtime.resource.loader.FileResourceLoader#file.resource.loader.path > = D:/bdf/workspace/Suren2/web/static/template/file.resource.loader.path > =file.resource.loader.cache = > falsefile.resource.loader.modificationCheckInterval = 2Instead of giving me > some accentuated characters, I get some ? which makes the email dirty. Could > you please give me a way to find how to resolve my problem? Best regards, > _________________________________________________________________ > Microsoft vous recommande de mettre à jour Internet Explorer. > http://specials.fr.msn.com/IE7P25 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
