5,960,554 th visitor since 2017.2.1 ( Today : 465 )
Programming
No. 649
Name. swindler
Subject. NCRs to UTF8 변환
Main Cate. Java
Sub Cate.
Date. 2009-07-20 11:50
Hit. 12260 (211.36.27.8)
File. Str.java   
〹 이런식으로 표기하는거를
NCRs 표기라고 부르는데 크게 2가지가 있음

�xfb; -> 이런식으로 16진수로 표기하는거를 Hexa NCRs라 부르고
〹 -> 이런식으로 10진수로 표기하는거를 Decimal NCRs 라고 부름.

현재 후자인 것 같아서,
그거를 utf8로 변환하는 함수를 저렇게 구현했음.

혹시 말이다.
Util에다가 넣게 되는경우에 Util이 utf8포맷이 아니면 혹시 잘못 변환될수가 있으니까.
그런 경우라면 그냥 jsp 에다가 박아넣는게 편할수도 있음 (아래처럼)


<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ page import="com.dnt7.*"%>
<%@ page import="java.util.*"%>

<%!

public static String convertNCRsToUtf8(String str)
{
String ostr = new String();
int i1 = 0;
for(int i2 = 0; i2 < str.length(); i2++)
{
i1 = str.indexOf("&#", i2);
if(i1 == -1)
{
ostr = ostr + str.substring(i2, str.length());
break;
}
ostr = ostr + str.substring(i2, i1);
i2 = str.indexOf(";", i1);
if(i2 == -1)
{
ostr = ostr + str.substring(i1, str.length());
break;
}
String tok = str.substring(i1 + 2, i2);
try
{
int radix = 10;
if(tok.trim().charAt(0) == 'x')
{
radix = 16;
tok = tok.substring(1, tok.length());
}
ostr = ostr + (char)Integer.parseInt(tok, radix);
}
catch(NumberFormatException exp)
{
ostr = ostr + '?';
}
}

return ostr;
}
%>




[바로가기 링크] : http://coolx.net/cboard/develop/649



dapoxetine apoth <a href=https://fastpriligy.top/>priligy tablet</a> As Jezebel s Tracie Egan Morrissey wrote What those lactivist expletive conveniently forget to tell people in their ongoing campaign of castigating bottle feeding mothers as unnatural and ignorant, masking their concern trolling as support is that breastfeeding, for many women, is an incredibly painful, almost traumatizing endeavor 2025-06-02
Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog