[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: JLDAP question regarding national characters (for example Umlauts in German)

If you print the string, is it formated correctly? you may need to do a new String(getBytes(),"UTF8") before isLDIFSafe works correctly.

------------------------------------------------------------------------ --------------------------
Marc Boorshtein
Sr. Software Engineer, Octet String
On Jan 5, 2005, at 6:00 AM, Radovan Skolnik wrote:


I'd like to ask a question regarding JLDAP an retrieving String values that
contain national characters (like Umlauts in German or characters like
ľščťžýáíé in Slovak, Czech and others). The example in code handles things
like this (taken from Search.java):

String Value = (String) allValues.nextElement();
if (Base64.isLDIFSafe(Value)) { // is printable
  System.out.println("      " + Value);
} else {
  // base64 encode and then print out
  Value = Base64.encode(Value.getBytes());
  System.out.println("      " + Value);

Now when a String with mentioned characters is received it goes the
Base64.encode way (which is undesirable). I've been trying to use
Base64.isValidUTF8(Value.getBytes(), false/true) however this gives false as
result for such Strings as well.

So the question stands: how to recognize what really is a String (with
special characters) and what should be Base64.encode-d?

Thanx a lot for replies.

	Radovan Skolnik

Ing. Radovan Skolnik
TEMPEST s.r.o.
Department of Enterprise Management
Plynarenska 7/B
821 09 Bratislava
Slovak Republic

E-mail: radovan_skolnik@tempest.sk
www:   http://www.tempest.sk
Tel:   +421 (2) 502 67 174
Fax:   +421 (2) 502 67 100

ITIL, SLM, Networking, Telecomm, Management, CORBA, Java and XML