Hi Bruce and anyone else

The conversion of the Alt-129 (small u umlaut) to the decimal value 252
occurs at the browser when it submits the form. 

Before the form is submitted it is still an ASCII 129 (hex 81) but the
submission process turns it into a ASCII 252 (hex FC). See the following:
http://www.w3schools.com/TAGS/ref_urlencode.asp 

When I put the data into the DP format 'synthetic' T-log it is an ASCII 252.
Obviously the point that it should be translated is when the T-log is
created, so that the ASCII 252 is put back to the original ASCII 129. Once
the ASCII 129 is in the DOS database it renders correctly in the webpage. 

My Perl is only fair to middling, but I think the following code on the data
going into the synthetic log might work, but if anyone can optimise this
code or do it a better way I would appreciate it as I think it might be
somewhat slow. 

#sample which includes a ü
print latin2dos("abcd".chr(252)."efg\nhijk") ;

# function to convert web submitted iso-8859-1 to DP's DOS charset
sub latin2dos {
        my $oldstring = shift ;
        my @oldchars = unpack("C*", $oldstring);
        my @newchars = map latin2dosChar($_), @oldchars ;
        my $newstring = join "", @newchars ;
        return $newstring ;
}

sub latin2dosChar {
        my $charcode = shift ;
        #using Bruce Conrad's translation table
        my @vals =   (
          0,   1,   2,   3,   4,   5,   6,   7,
          8,   9,  10,  11,  12,  13,  14,  15,
         16,  17,  18,  19,  22,  23,  24,  25,
         26,  27,  28,  29,  30,  31, 127, 158,
         32,  33,  34,  35,  36,  37,  38,  39,
         40,  41,  42,  43,  44,  45,  46,  47,
         48,  49,  50,  51,  52,  53,  54,  55,
         56,  57,  58,  59,  60,  61,  62,  63,
         64,  65,  66,  67,  68,  69,  70,  71,
         72,  73,  74,  75,  76,  77,  78,  79,
         80,  81,  82,  83,  84,  85,  86,  87,
         88,  89,  90,  91,  92,  93,  94,  95,
         96,  97,  98,  99, 100, 101, 102, 103,
        104, 105, 106, 107, 108, 109, 110, 111,
        112, 113, 114, 115, 116, 117, 118, 119,
        120, 121, 122, 123, 124, 125, 126, 159,
        169, 176, 177, 178, 179, 180, 181, 182,
        183, 184, 185, 186, 187, 188, 189, 190,
        191, 192, 193, 194, 195, 196, 197, 198,
        199, 200, 201, 202, 203, 204, 205, 206,
        255, 173, 155, 156, 207, 157, 208,  21,
        209, 210, 166, 174, 170, 211, 212, 213,
        248, 241, 253, 214, 215, 230,  20, 249,
        216, 217, 167, 175, 172, 171, 218, 168,
        219, 220, 221, 222, 142, 143, 146, 128,
        223, 144, 224, 225, 226, 227, 228, 229,
        231, 165, 232, 233, 234, 235, 153, 236,
        237, 238, 239, 240, 154, 242, 243, 244,
        133, 160, 131, 245, 132, 134, 145, 135,
        138, 130, 136, 137, 141, 161, 140, 139,
        247, 164, 149, 162, 147, 250, 148, 246,
        251, 151, 163, 150, 129, 252, 254, 152
        ) ;
        return chr($vals[$charcode]) ;

}



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Bruce Conrad
Sent: Thursday, 21 May 2009 3:50 AM
To: [email protected]
Subject: Re: [Dataperf] DP-Web and ASCII-DOS and iso-8859-1

Hi Ludwig and Brian,

All of the output from a DP report could be run through a translation  
with the "dosToLatin" translation table. All form values coming in  
from the web browser could be run through the "latinToDos" translation  
table. This assumes that the browser and web pages are set up to use  
the iso-8859-1 character set (as opposed to, say, unicode (most  
commonly UTF-8)). This should handle most European language  
characters. Although an adjustment will be needed for the Euro symbol  
(which did not exist back when I put together these translation tables).

Best wishes,
Bruce

On May 19, 2009, at 11:58 PM, Ludwig Güthlein wrote:

> Hi Bruce
> and everyone who answered my question regarding how to deal with  
> charcters from the extended ASCII-Dos-characterset
>
> I changed the topic and started a new threat (see former threat at  
> the end of this mail).
>
> When I use DP-Web the characters from the DP-Database are shown  
> properly in the Web-Browser-display.
> But trying to enter characters into the database via the browser- 
> interface (edit and save) all extended characters are changed to  
> something else.
>
> Now I understand the difference of ascii-dos and iso-8859-1 Latin  
> charstet. At which moment of the import-report-perl-script should a  
> conversion programm (if I find one) be activated?
>
> Thanks for your last answer and for any help
>
> Ludwig Güthlein
>
>
> ------ former threat:
>
> Hi Ludwig,
>
> DP uses an extended ASCII character set peculiar to the IBM PC. On the
> web, I tend to use to "Latin" character set (officially known as
> iso-8859-1). So, in the firestorm way of doing DP on the web, there  
> is  an
> in-built translation table for moving characters first from DOS to   
> the
> Latin character set (for displaying data from within DP) and then  for
> translating characters from Latin to DOS (for bringing data into  DP).
>
> Brian's suggestion to use character entities might help. If not, even
> though this isn't directly useful to you, I am attaching the two
> translation tables. Character 129 in DOS maps to character 252 in   
> Latin,
> and vice versa. Perhaps this translation could be built in to  the  
> Perl
> script?
>
> Best wishes,
> Bruce
>
> P.S. Rather than attaching, am just pasting it in here:
>
> unsigned char dosToLatin[256] = {
>    0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,
> 13,  14,  15,
>   16,  17,  18,  19, 182, 167,  20,  21,  22,  23,  24,  25,  26,
> 27,  28,  29,
>   32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
> 45,  46,  47,
>   48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,
> 61,  62,  63,
>   64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,
> 77,  78,  79,
>   80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,
> 93,  94,  95,
>   96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
> 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,  
> 123, 124,
> 125,  126,  30, 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232,
> 239, 238, 236,  196, 197, 201, 230, 198, 244, 246, 242, 251, 249, 255,
> 214, 220, 162, 163, 165,   31, 127, 225, 237, 243, 250, 241, 209, 170,
> 186, 191, 128, 172, 189, 188, 161,  171, 187, 129, 130, 131, 132, 133,
> 134, 135, 136, 137, 138, 139, 140, 141, 142,  143, 144, 145, 146, 147,
> 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158,  159, 164, 166,
> 168, 169, 173, 174, 175, 179, 180, 184, 185, 190, 192, 193, 194,  195,
> 200, 202, 203, 204, 205, 206, 207, 181, 208, 210, 211, 212, 213,  
> 215, 216,
>  217, 218, 219, 177, 221, 222, 223, 227, 247, 240, 176, 183, 245, 248,
> 253, 178,  254, 160 }; unsigned char latinToDos[256] = {
>    0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,
> 13,  14,  15,
>   16,  17,  18,  19,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
> 127, 158,
>   32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
> 45,  46,  47,
>   48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,
> 61,  62,  63,
>   64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,
> 77,  78,  79,
>   80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,
> 93,  94,  95,
>   96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
> 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,  
> 123, 124,
> 125,  126, 159, 169, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
> 186, 187, 188,  189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
> 200, 201, 202, 203, 204,  205, 206, 255, 173, 155, 156, 207, 157, 208,
> 21, 209, 210, 166, 174, 170, 211,  212, 213, 248, 241, 253, 214,  
> 215, 230,
>  20, 249, 216, 217, 167, 175, 172, 171,  218, 168, 219, 220, 221, 222,
> 142, 143, 146, 128, 223, 144, 224, 225, 226, 227,  228, 229, 231, 165,
> 232, 233, 234, 235, 153, 236, 237, 238, 239, 240, 154, 242,  243, 244,
> 133, 160, 131, 245, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161,
> 140, 139, 247, 164, 149, 162, 147, 250, 148, 246, 251, 151, 163,  
> 150, 129,
> 252,  254, 152 };
>
> On May 19, 2009, at 2:27 AM, Ludwig Güthlein wrote:
>
> > Hello to everyone!
> >
> > Following this discussion I made my first try with this DP-Web-
> > Sample and it works perfect on a
> > Vista-Notebook and on a XP-Desktop. Thank you very much.
> >
> > I have translated the necessary terms of the reports into German  
> and  it
> > works smoothly. I have run into one problem: If I enter a charcter  
> of
> > the extended- ASCII-set it is not converted correctly. In detail  
> with
> > the letter u-diaresis (i.e. a german u with 2 dots  above) =  
> ASCII129:
> >
> > - if I enter the letter ASCII-129 directly into the DP-Database  
> it  is
> > shown correct in the DOS environment - then I can run DP-Web- 
> Sample and
> > the letter is shown correct in  the browser - when I edit the record
> > from the browser I can enter ASCII-129  correctly - after saving  
> this
> > u-diaresis (ASCII-129) ist saved in the DP- Databse as ASCII-236  
> (a y
> > with an accent) -from now on the browser will always show this y  
> with
> > accent  (ASCII-236)
> >
> > Actually all letters from the extended-character-set a convert to
> > something (for me unpredectable) when saved by the edit and save  
> command
> > of the  browser-page.
> >
> > Has it something to do with my german environment of windows and
> > dos? Is there a way to
> > control the conversion of these extended-charset-letters?
> >
> > Thank you for any help.
> >
> > DP is the fastest way to build a database and to control any  
> amount  of
> > data. Thank you to all who keep it alive.
> >
> > Ludwig Güthlein
>
>
>
>
>
>
> --
> Ludwig Güthlein
> Berg Sion 6, 56179 Vallendar
> Tel/Fax: 0261-9632223
> eMail: [email protected]
>
>
> _______________________________________________
> Dataperf mailing list
> [email protected]
> http://lists.dataperfect.nl/mailman/listinfo/dataperf

_______________________________________________
Dataperf mailing list
[email protected]
http://lists.dataperfect.nl/mailman/listinfo/dataperf

_______________________________________________
Dataperf mailing list
[email protected]
http://lists.dataperfect.nl/mailman/listinfo/dataperf

Reply via email to