Problem tildes and special characters java

0

I have a problem with the accents and special characters in a Java project in Eclipse. It is an imported project and I have already configured it in Eclipse on Windows - > Preferences - > General - > Workspace - > Text file encoding and Content Types - > Text - > Deafult encoding and is set to UTF-8 and nothing. The content that is not loaded correctly is in a .properties file with the following code:

   NLS_INCLUDES=com.documentum.webcomponent.library.locator.LocatorContainerNlsProp
MSG_TITLE_LANZAR_WF=Crear Lote
MSG_UN=Unidad de Negocio / Área
MSG_COD_UN=Código de Negocio / Actividad
MSG_RESP_LOTE=Responsable Lote
MSG_TIPO_LOTE=Tipo de Lote
MSG_LOCALIZADOR=Localizador

MSG_MUST_HAVE_NAME=El campo debe estar relleno.

MSG_TITLE= Crear Lote 
MSG_OBJECT=

MSG_IS_REQUIERED=El campo es requerido

MSG_OK=OK
MSG_CANCEL=Cancel
MSG_OK_TIP=OK
MSG_CANCEL_TIP=Cancel

Later, in a jsp the information is displayed:

<%@ page contentType="text/html" %>
<%@ page import='com.mppan.workflow.LanzarWF' %>
<%@ page errorPage="/wdk/errorhandler.jsp" %>

<%@ taglib uri="/WEB-INF/tlds/dmform_1_0.tld" prefix="dmf" %>
<%@ taglib uri="/WEB-INF/tlds/dmformext_1_0.tld" prefix="dmfx" %>
<%@ taglib uri="/WEB-INF/tlds/dmformext_1_0.tld" prefix="dmfx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"          "http://www.w3.org/TR/html4/loose.dtd">
<dmf:html>
<dmf:head>
<dmf:webcontainerrequirements/>
<dmf:webform/>
<dmf:title><dmf:label nlsid="MSG_TITLE_LANZAR_WF"/></dmf:title>
</dmf:head>

<dmf:form>
<div><dmf:label cssclass='dialogTitle' nlsid='MSG_TITLE_LANZAR_WF'/>            </div>
<html>

<body>

<table>



    <tr>    
        <td class="leftAlignment"><dmf:label name='lblUnWF'      nlsid='MSG_UN' style="font-weight:bold"/>: </td>
        <td><dmf:dropdownlist name='<%= LanzarWF.CTRL_TXT_UN %>'     width='300'/> 
    <dmf:requiredfieldvalidator     name='<%=LanzarWF.CTRL_REQUIRED_FIELD_CTRL_TXT_UN%>' controltovalidate="<%=     LanzarWF.CTRL_TXT_UN%>" nlsid="MSG_IS_REQUIERED" /></td>
    </tr>

    <tr>    
        <td><dmf:label name='lblCodUnWF'  nlsid='MSG_COD_UN' style="font-weight:bold"/>:</td> 
        <td align='left'><dmf:dropdownlist name= '<%=     LanzarWF.CTRL_TXT_COD_UN %>' width='300'/> 
        <dmf:requiredfieldvalidator     name='<%=LanzarWF.CTRL_REQUIRED_FIELD_CTRL_TXT_COD_UN%>'     controltovalidate="<%= LanzarWF.CTRL_TXT_COD_UN%>" nlsid="MSG_IS_REQUIERED"     /></td>                        
    </tr>

    <tr>
        <td class="leftAlignment"><dmf:label name='lblRsepLoteWF'     nlsid='MSG_RESP_LOTE' style="font-weight:bold"/>:</td>
        <td align='left'><dmf:text name='<%= LanzarWF.CTRL_TXT_RESP_LOTE %>'  size='60' enabled='false'/></td>
    </tr>

    <tr>    
        <td class="leftAlignment"><dmf:label name='lblTipoLoteWF'  nlsid='MSG_TIPO_LOTE' style="font-weight:bold"/>:</td> 
        <td align='left'><dmf:dropdownlist name='<%= LanzarWF.CTRL_TXT_TIPO_LOTE %>' width='300'/> 
        <dmf:requiredfieldvalidator name='<%=LanzarWF.CTRL_REQUIRED_FIELD_CTRL_TXT_TIPO_LOTE%>' controltovalidate="<%= LanzarWF.CTRL_TXT_TIPO_LOTE%>" nlsid="MSG_IS_REQUIERED" /></td>
    </tr>

    <tr>
        <td class="leftAlignment"><dmf:label name='lblLocalizadorWF' nlsid='MSG_LOCALIZADOR' style="font-weight:bold"/>:</td>
        <td align='left'><dmf:text name='<%= LanzarWF.CTRL_TXT_LOCALIZADOR %>'  size='60'/>
        </td>
    </tr>



</table>
</body>
</html>
</dmf:form>
</dmf:html>

Attached photo of the error:

Let's see if you can give me a cable that I do not know what to touch anymore.

Thank you very much and greetings!

    
asked by Ganejash 23.03.2018 в 13:52
source

2 answers

3

You must modify <%@ page contentType="text/html" %> by <%@ page contentType="text/html; charset=UTF-8" %> , and with that you should not have problems

    
answered by 23.03.2018 / 14:01
source
3

The * .properties files, when read by Java, have always to comply with ISO 8859-1 encoding:

  

public void load(InputStream inStream) throws IOException

     

Reads a property list (key and element pairs) from the input byte   stream The input stream is in a simple line-oriented format as   specified in load (Reader) and is assumed to use the ISO 8859-1   character encoding; that is each byte is one Latin1 character.   Characters not in Latin1, and certain special characters, are   represented in keys and elements using Unicode escapes as defined in   section 3.3 of The Java ™ Language Specification.

You must escape non-standard characters. A convenient way to do it in Eclipse is to use the ResourceBundle Editor plugin, which does it automatically.

    
answered by 23.03.2018 в 14:00