Project

General

Profile

« Previous | Next » 

Revision 2449

Added by sgarg over 19 years ago

Changing the normalize function. Adding changes submitted by Johnoel. Removing code for converting " as " can be stored as it on Oracle. Removing code which strips out \n and \r

View differences:

src/edu/ucsb/nceas/metacat/MetaCatUtil.java
256 256
                         break;
257 257
                     }
258 258
                     case '&': {
259
                         str.append("&");
259
                         /*
260
                          * patch provided by Johnoel Ancheta from U of Hawaii
261
                          */
262
                         // check if & is for a character reference &#xnnnn;
263
                         if (i + 1 < len - 1 && s.charAt(i + 1) == '#') {
264
                             str.append("&#");
265
                             i += 2;
266

  
267
                             ch = s.charAt(i);
268
                             while (i < len && ch != ';') {
269
                                 str.append(ch);
270
                                 i++;
271
                                 ch = s.charAt(i);
272
                             }
273
                             str.append(';');
274
                         }
275
                         else
276
                             str.append("&amp;");
277
                         /////////
260 278
                         break;
261 279
                     }
262
                     case '"': {
263
                         str.append("&quot;");
264
                         break;
265
                     }
266
                     case '\r':
267
                     case '\n': {
268
                         // else, default append char
269
                     }
270
                     default: {
271
                         if ((ch<128)&&(ch>31)) {
280
                    default: {
281
                         if ( (ch<128) && (ch>31) ) {
272 282
                             str.append(ch);
273 283
                         }
274 284
                         else if (ch<32) {
275
                             if (ch== 10) {
285
                             if (ch == 10) { // new line
276 286
                                 str.append(ch);
277 287
                             }
278
                             if (ch==13) {
288
                             if (ch == 13) { // carriage return
279 289
                                 str.append(ch);
280 290
                             }
281
                             if (ch==9) {
291
                             if (ch == 9) {  // tab
282 292
                                 str.append(ch);
283 293
                             }
284 294
                             // otherwise skip

Also available in: Unified diff