TC358840XBG/TC358870XBG HDMI to MIPI DSI .htd file format - embed

Long story short, for an on-going POC, I need to 'port' a 'software fix directly into some hardware.
I'm using some 'control boards' ( blue square pcbs ) from AliExpress to drive some displays, but on Mac OS, it seems I can't select whether to output YCrBr or RGB.
These have a Toshiba's TC358870XBG as well as a stm32-like chip ( CH32 clone )
After digging the subject on Mac OS ( I already knew some stuff on EDIDs and some tools on GNU/Linux ), I've found so-called 'display overrides' that can force a particular EDID to be used depending on vendor/product ID of the connected display.
After successfully 'overriding' each display's EDID for my needs, I've also managed to write myself a 'universal fix' that works across displays ( which actually 'patches' the EDID of the display instead of overriding it ) - as a side info, these all share a common vendorId/productId as well as same serial & manufacturing week/year
Now, I've been thankfully given a windows tool called 'HDMI to MIPI DSI' that supposedly allows to update some params to correctly drive a particular display, yet it doesn't allow to tweak the fields I need ( those are not even shown in its GUI ).
Also, it uses a 'HTD' file as source file for the flashing procedure ( which is likely to end up being sent over I2C from the stm32-like chip to the TC358870XBG )
Being given an '.HTD' file along with it, I managed to save its content as 'RAW.txt' for study.
Looking for an EDID in it, I've successfully found both blocks 1 & 2, aka 256 bytes worth of data :)
Now, digging the remaining content in that file, I wrote some code that tries to find which hex values could be some TC358870XBG's register addresses ( still an early wip, but with more work I may get it to differentiate better ? ).
While it can help in knowing the 'TC358870XBG's initialization steps' done for a particular display, I can't currently grasp how to 'convert' from 'RAW.txt' to '.HTD' file, hence my question here.
Anyone with knowledge worth sharing on this ? :)
For the one(s) interested:
the bytes I'm trying to extract infos from:
---- .TXT BLOB ----
VM97:1367 0x00 0x24 0x08 0x04 0x0f 0x01 0x0e 0x00 0x05 0x00 0x14 0x02 0x04 0x12 0x00 0x0e 0x00 0x05 0x00 0x14 0x03 0x04 0x11 0x00 0x0e 0x00 0x05 0x00 0x14 0x09 0x04 0x0f 0x00 0x0e 0x00 0x05 0x00 0x14 0x3d 0x00 0x1b 0x05 0x10 0x00 0x04 0x00 0x04 0x10 0x00 0x02 0x3f 0x01 0x26 0x03 0xe8 0x10 0x00 0x02 0x00 0x00 0x10 0x00 0x06 0x00 0x08 0x3e 0x00 0xd9 0x1f 0x20 0x01 0x08 0x00 0x00 0x00 0x01 0x20 0x01 0x0c 0x00 0x00 0x00 0x01 0x20 0x02 0xa0 0x00 0x00 0x00 0x01 0x20 0x02 0xac 0x00 0x00 0x90 0x8a 0x26 0x07 0xd0 0x20 0x02 0xa0 0x00 0x00 0x00 0x03 0x20 0x01 0x18 0x00 0x00 0x00 0x14 0x20 0x01 0x20 0x00 0x00 0x12 0x05 0x20 0x01 0x24 0x00 0x00 0x00 0x00 0x20 0x01 0x28 0x00 0x00 0x01 0x01 0x20 0x01 0x30 0x00 0x01 0x00 0x00 0x20 0x01 0x34 0x00 0x00 0x50 0x00 0x20 0x01 0x38 0x00 0x01 0x00 0x00 0x20 0x01 0x3c 0x00 0x01 0x00 0x00 0x20 0x01 0x40 0x00 0x01 0x00 0x00 0x20 0x01 0x44 0x00 0x01 0x00 0x00 0x20 0x01 0x48 0x00 0x00 0x10 0x00 0x20 0x01 0x4c 0x00 0x01 0x00 0x00 0x20 0x01 0x50 0x00 0x00 0x01 0x61 0x20 0x01 0x54 0x00 0x00 0x00 0x01 0x20 0x01 0x58 0x00 0x00 0x00 0xc8 0x20 0x01 0x68 0x00 0x00 0x00 0x2a 0x20 0x01 0x70 0x00 0x00 0x02 0x7c 0x20 0x01 0x7c 0x00 0x00 0x00 0x81 0x20 0x01 0x8c 0x00 0x00 0x00 0x3a 0x20 0x01 0x90 0x00 0x00 0x00 0x84 0x20 0x01 0xa4 0x00 0x00 0x00 0x00 0x20 0x01 0xc0 0x00 0x00 0x00 0x15 0x20 0x02 0x14 0x00 0x00 0x00 0x00 0x20 0x02 0x1c 0x00 0x00 0x00 0x80 0x20 0x02 0x24 0x00 0x00 0x00 0x00 0x3f 0x00 0x5f 0x0d 0x20 0x02 0x54 0x00 0x00 0x00 0x04 0x20 0x02 0x58 0x00 0x1e 0x02 0x04 0x20 0x02 0x5c 0x00 0x0a 0x00 0x08 0x20 0x02 0x60 0x00 0x0e 0x00 0x06 0x20 0x02 0x64 0x00 0x00 0x48 0x15 0x20 0x02 0x68 0x00 0x00 0x00 0x0c 0x20 0x02 0x6c 0x00 0x0a 0x00 0x07 0x20 0x02 0x70 0x00 0x00 0x00 0x20 0x20 0x02 0x74 0x00 0x00 0x00 0x1f 0x20 0x02 0x78 0x00 0x04 0x00 0x05 0x20 0x02 0x7c 0x00 0x00 0x00 0x02 0x20 0x02 0x88 0x00 0x00 0x02 0xaa 0x20 0x01 0x1c 0x00 0x00 0x00 0x01 0x40 0x00 0xd9 0x1f 0x20 0x03 0x08 0x00 0x00 0x00 0x01 0x20 0x03 0x0c 0x00 0x00 0x00 0x01 0x20 0x04 0xa0 0x00 0x00 0x00 0x01 0x20 0x04 0xac 0x00 0x00 0x90 0x8a 0x26 0x07 0xd0 0x20 0x04 0xa0 0x00 0x00 0x00 0x03 0x20 0x03 0x18 0x00 0x00 0x00 0x14 0x20 0x03 0x20 0x00 0x00 0x12 0x05 0x20 0x03 0x24 0x00 0x00 0x00 0x00 0x20 0x03 0x28 0x00 0x00 0x01 0x01 0x20 0x03 0x30 0x00 0x01 0x00 0x00 0x20 0x03 0x34 0x00 0x00 0x50 0x00 0x20 0x03 0x38 0x00 0x01 0x00 0x00 0x20 0x03 0x3c 0x00 0x01 0x00 0x00 0x20 0x03 0x40 0x00 0x01 0x00 0x00 0x20 0x03 0x44 0x00 0x01 0x00 0x00 0x20 0x03 0x48 0x00 0x00 0x10 0x00 0x20 0x03 0x4c 0x00 0x01 0x00 0x00 0x20 0x03 0x50 0x00 0x00 0x01 0x61 0x20 0x03 0x54 0x00 0x00 0x00 0x01 0x20 0x03 0x58 0x00 0x00 0x00 0xc8 0x20 0x03 0x68 0x00 0x00 0x00 0x2a 0x20 0x03 0x70 0x00 0x00 0x02 0x7c 0x20 0x03 0x7c 0x00 0x00 0x00 0x81 0x20 0x03 0x8c 0x00 0x00 0x00 0x3a 0x20 0x03 0x90 0x00 0x00 0x00 0x84 0x20 0x03 0xa4 0x00 0x00 0x00 0x00 0x20 0x03 0xc0 0x00 0x00 0x00 0x15 0x20 0x04 0x14 0x00 0x00 0x00 0x00 0x20 0x04 0x1c 0x00 0x00 0x00 0x80 0x20 0x04 0x24 0x00 0x00 0x00 0x00 0x41 0x00 0x5f 0x0d 0x20 0x04 0x54 0x00 0x00 0x00 0x04 0x20 0x04 0x58 0x00 0x1e 0x02 0x04 0x20 0x04 0x5c 0x00 0x0a 0x00 0x08 0x20 0x04 0x60 0x00 0x0e 0x00 0x06 0x20 0x04 0x64 0x00 0x00 0x48 0x15 0x20 0x04 0x68 0x00 0x00 0x00 0x0c 0x20 0x04 0x6c 0x00 0x0a 0x00 0x07 0x20 0x04 0x70 0x00 0x00 0x00 0x20 0x20 0x04 0x74 0x00 0x00 0x00 0x1f 0x20 0x04 0x78 0x00 0x04 0x00 0x05 0x20 0x04 0x7c 0x00 0x00 0x00 0x02 0x20 0x04 0x88 0x00 0x00 0x02 0xaa 0x20 0x03 0x1c 0x00 0x00 0x00 0x01 0x42 0x00 0x15 0x03 0x20 0x01 0x10 0x00 0x00 0x00 0x16 0x20 0x03 0x10 0x00 0x00 0x00 0x16 0x26 0x04 0xb0 0x43 0x00 0x0c 0x02 0x26 0x00 0x0a 0x10 0x05 0x00 0x00 0x04 0x0d 0x00 0x0f 0x00 0x02 0x00 0x05 0x00 0x05 0x11 0x00 0x05 0x00 0x05 0x00 0x0e 0x00 0x05 0x01 0x2c 0x0d 0x00 0x2d 0x00 0x07 0x00 0x06 0x00 0x23 0xb0 0x04 0x00 0x06 0x00 0x23 0xb3 0x10 0x00 0x06 0x00 0x23 0xb0 0x03 0x00 0x06 0x00 0x15 0x36 0x00 0x00 0x06 0x00 0x15 0x3a 0x77 0x00 0x05 0x00 0x05 0x29 0x00 0x05 0x00 0x05 0x00 0x0e 0x00 0x05 0x00 0x1e 0x44 0x00 0x1d 0x05 0x10 0x50 0x00 0x00 0x00 0x10 0x50 0x08 0x08 0x70 0x10 0x50 0x0c 0x80 0x00 0x10 0x50 0x80 0x00 0x00 0x10 0x50 0x88 0x08 0x70 0x45 0x00 0x14 0x04 0x08 0x84 0x10 0x03 0x08 0x84 0x13 0x3f 0x08 0x84 0xf0 0x31 0x08 0x84 0xf4 0x01 0x46 0x00 0x1b 0x05 0x10 0x85 0x40 0x12 0xc0 0x08 0x86 0x30 0x00 0x10 0x86 0x31 0x07 0x53 0x08 0x86 0x70 0x02 0x10 0x8a 0x0c 0x12 0xc0 0x47 0x00 0x18 0x05 0x08 0x85 0x02 0xff 0x08 0x85 0x12 0xfe 0x08 0x85 0x14 0x00 0x08 0x85 0x15 0x00 0x08 0x85 0x16 0x00 0x48 0x00 0x0e 0x02 0x10 0x00 0x14 0x0f 0xbf 0x10 0x00 0x16 0x0f 0xff 0x49 0x00 0x0d 0x02 0x08 0x85 0xe0 0x01 0x10 0x85 0xe3 0x01 0x00 0x4a 0x01 0x06 0x24 0x8c 0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0x00 0x33 0x54 0x01 0x00 0x00 0x00 0x00 0x00 0x0c 0x1b 0x01 0x03 0x80 0x00 0x00 0x78 0x0a 0x07 0xf5 0x9a 0x56 0x4e 0x86 0x26 0x1e 0x50 0x54 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0x00 0x00 0x00 0xfc 0x00 0x4c 0x53 0x30 0x36 0x30 0x52 0x31 0x53 0x58 0x30 0x31 0x20 0x20 0x00 0x00 0x00 0xff 0x00 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x20 0x20 0x20 0x20 0x20 0x00 0x00 0x00 0xfd 0x00 0x17 0x4b 0x0f 0xf0 0x22 0x00 0x0a 0x20 0x20 0x20 0x20 0x20 0x20 0x01 0x7e 0x02 0x03 0x17 0x74 0x47 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x23 0x09 0x7f 0x07 0x66 0x03 0x0c 0x00 0x30 0x00 0x80 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x8d 0x4b 0x00 0x14 0x04 0x08 0x85 0xd1 0x01 0x08 0x85 0x60 0x24 0x08 0x85 0x63 0x11 0x08 0x85 0x64 0x0f 0x4c 0x00 0x14 0x04 0x08 0x8a 0x00 0x00 0x08 0x8a 0x01 0x14 0x08 0x8a 0x02 0x42 0x08 0x8a 0x08 0x11 0x4d 0x00 0x0c 0x02 0x08 0x85 0x43 0x02 0x08 0x85 0x44 0x11 0x4e 0x00 0x32 0x09 0x08 0x86 0x00 0x00 0x08 0x86 0x02 0xf3 0x08 0x86 0x03 0x02 0x08 0x86 0x04 0x0c 0x08 0x86 0x06 0x05 0x08 0x86 0x07 0x00 0x08 0x86 0x52 0x02 0x20 0x86 0x71 0x02 0x0c 0x49 0xba 0x20 0x86 0x75 0x01 0xe1 0xb0 0x89 0x08 0x86 0x80 0x00 0x4f 0x00 0x08 0x01 0x08 0x85 0x4a 0x01 0x50 0x00 0x04 0x00 0x51 0x00 0x0e 0x02 0x10 0x00 0x04 0x0c 0x37 0x10 0x00 0x06 0x00 0x00 0x52 0x00 0x15 0x03 0x20 0x01 0x10 0x00 0x00 0x00 0x06 0x20 0x03 0x10 0x00 0x00 0x00 0x06 0x26 0x86 0xa0 0x0e 0x00 0x05 0x03 0xe8 0x0c 0x04 0x0b 0x00 0x04 0x00 0x02 0x00 0x00
length: 1344
---- .HTD BLOB ----
0x43 0x1b 0x90 0xc2 0x17 0x77 0x15 0x79 0x18 0x00 0x1a 0x0f 0x71 0x15 0x17 0x15 0x6e 0x40 0x35 0x44 0xb8 0x1c 0x5f 0x38 0x32 0x49 0x81 0x18 0xbc 0xf1 0x2b 0x9d 0x6c 0xd1 0x2b 0x31 0x2b 0x0f 0xc1 0xba 0x82 0x95 0x8f 0xd7 0x86 0xe9 0x4b 0x25 0x5e 0x53 0xec 0x5a 0x6c 0x7e 0xf8 0xbe 0x86 0x39 0xcf 0xd3 0xef 0x39 0x22 0x14 0xb4 0x92 0xd7 0xb4 0x49 0x04 0x32 0x7c 0x0d 0x23 0xc1 0xf9 0x7c 0x55 0xaa 0xd1 0xab 0x8e 0xd7 0x45 0xd2 0x55 0x5a 0x27 0xcd 0xfe 0x76 0x99 0xa3 0x2c 0x99 0xfc 0x99 0x6c 0xa4 0x73 0xc8 0x4a 0xcc 0x22 0x49 0x67 0x33 0x3d 0x90 0xe9 0xca 0x01 0xf6 0xcc 0x01 0xef 0xb1 0x17 0x6b 0x4b 0x7a 0x8c 0x86 0x70 0xc4 0x2e 0x8a 0x53 0x92 0x53 0x24 0x2f 0x2a 0x73 0x9e 0xcf 0xe5 0xde 0xb9 0xdb 0x20 0x75 0x10 0x27 0x79 0x2d 0xd8 0xf1 0x47 0x6f 0x0c 0x5e 0x28 0xcd 0x00 0x12 0x5b 0x17 0x7c 0xd1 0x1d 0xc1 0x51 0x19 0x3d 0x81 0x05 0x71 0xd9 0x1a 0x77 0xf8 0x80 0x12 0xea 0xc1 0xd9 0x88 0x55 0x5b 0x9a 0x48 0x9f 0x13 0x9f 0x4c 0xfc 0x00 0xcb 0x84 0x47 0x1b 0xe0 0xa1 0xb7 0x48 0x48 0x3f 0x17 0xa9 0x8a 0xe3 0x46 0x30 0x3f 0x97 0x53 0xf5 0x6c 0x38 0x24 0xce 0xf0 0xcd 0x8f 0xc7 0x7d 0x0e 0x9c 0x91 0x10 0xed 0x48 0x61 0x4d 0xf6 0x57 0x79 0x01 0xe7 0x0a 0x14 0xc1 0x25 0x93 0x99 0xab 0x8d 0xcd 0xba 0x82 0xf5 0x03 0x19 0xf4 0xeb 0x58 0x3f 0x44 0xef 0xed 0x3b 0xbb 0x8f 0x4b 0xd9 0xab 0x8f 0x0e 0x50 0xfd 0xcf 0x2b 0x5e 0xbe 0x64 0x03 0xfe 0xe0 0x6b 0xac 0x1d 0xa4 0x0e 0xf3 0xcc 0x38 0x3d 0x53 0x18 0xc1 0xa5 0xb3 0x44 0x67 0x46 0xe7 0xfa 0xad 0x48 0x03 0xe8 0xd5 0x95 0x9f 0xd1 0x9f 0xd1 0x5b 0x13 0x9f 0x6e 0x26 0x1e 0x23 0xc7 0x15 0x5f 0x97 0x25 0xda 0x48 0xaa 0x3b 0xa6 0x79 0x3d 0xdd 0x8d 0xed 0xe7 0xdf 0x3e 0xe4 0xdb 0xe4 0xdd 0x87 0x8c 0x05 0x7d 0x90 0xdc 0x3a 0x6b 0x5e 0xb9 0xe0 0xe2 0xad 0x1d 0xc6 0x84 0xb9 0x8f 0xc1 0x1a 0x09 0x8d 0x3a 0x3b 0xd9 0x33 0x29 0x36 0x04 0x14 0x26 0xf4 0x55 0xe8 0x49 0x4f 0x88 0x63 0x71 0x0d 0x1d 0x37 0x53 0xfc 0xd3 0x49 0x3a 0x99 0x9b 0x18 0x76 0x4e 0x69 0x13 0x03 0xa8 0x67 0xbf 0xe4 0x61 0x9b 0x45 0x7b 0xca 0x78 0xdd 0x9d 0x4f 0xae 0x8e 0x40 0x28 0x36 0x0d 0x85 0x93 0xa1 0xd0 0xab 0x9f 0x20 0xd1 0xeb 0x9a 0x63 0x5d 0x33 0xc7 0xd3 0x34 0x09 0xb6 0x42 0x2e 0x99 0x8a 0xe8 0x13 0xae 0xe6 0xb1 0xd7 0x79 0x34 0x4d 0x29 0x98 0xbe 0x79 0xc5 0x68 0xd0 0xeb 0x0c 0x56 0xe8 0x85 0xa8 0xab 0x08 0x34 0xdd 0x81 0x90 0x9e 0x71 0x7a 0xcd 0x58 0x4d 0x4b 0x08 0x1a 0x2e 0x94 0xad 0xda 0xd8 0x31 0x3e 0x67 0x74 0x5a 0x92 0x8d 0x0a 0xa0 0x23 0x2f 0x1f 0x1d 0x19 0xaa 0x2c 0x1c 0xb6 0x86 0x98 0xc3 0xe3 0x68 0xc1 0x89 0x47 0xaf 0x17 0x7f 0x1c 0x95 0xb7 0x1c 0xa7 0xf6 0x83 0xc9 0x1d 0xe3 0xc7 0x5c 0xcc 0x44 0xe9 0x36 0x43 0x07 0xc2 0xbc 0x44 0xdf 0x3c 0x51 0xe5 0x61 0x39 0xb7 0x6f 0xbb 0x53 0xcc 0x5a 0x17 0xbc 0x54 0x22 0x83 0x7c 0x69 0x29 0x1a 0xd8 0xad 0x61 0xb4 0x9f 0xa0 0x07 0x29 0x44 0xef 0x79 0x68 0xb1 0xc2 0x97 0xbb 0x77 0x38 0x82 0x6e 0x23 0xcd 0xb8 0xcd 0x1a 0xd0 0x7d 0x7e 0x0e 0x98 0xbe 0x51 0x06 0x09 0xb0 0xc8 0x44 0xbe 0xc3 0xdb 0x6a 0xe0 0x20 0x9b 0xb4 0x56 0x88 0x35 0xdb 0x4c 0xb1 0x99 0x4a 0x30 0x65 0x49 0x0a 0x13 0xc2 0x0d 0x87 0x79 0x66 0xbf 0xb4 0xed 0x4b 0xb2 0x90 0x92 0x78 0x52 0xf1 0x0a 0x31 0x74 0x57 0x01 0x13 0x04 0x13 0x0f 0xd5 0x8b 0x5b 0x9b 0x79 0x6a 0x48 0x82 0x48 0xfb 0xe6 0xff 0xc1 0x3e 0x0c 0xb2 0x98 0x02 0x15 0x67 0x99 0x16 0x4f 0x8f 0x90 0xae 0x38 0xc1 0x8f 0x4a 0x98 0xfb 0xe5 0x00 0xdf 0xee 0x67 0x07 0x68 0xaf 0xc3 0x44 0xb8 0x87 0xa4 0x4f 0xc8 0xca 0x6d 0xe0 0x2c 0xa2 0xa3 0x9d 0x5d 0xde 0xb9 0x77 0x73 0x6b 0xaf 0xa2 0x9e 0x9f 0xdc 0x1c 0x7c 0x79 0x70 0x06 0xde 0x5b 0xe3 0x66 0x74 0x4e 0x63 0xdf 0x0c 0xea 0x22 0xc3 0xda 0xbd 0x8b 0xc2 0x28 0x22 0xc1 0xbe 0x8d 0xb7 0xa0 0xa8 0x9d 0xfa 0xc8 0xb8 0x3e 0xac 0x29 0x6b 0x31 0xcd 0xcd 0xea 0xfa 0x16 0xbb 0x60 0xe4 0x28 0x93 0x00 0xbb 0x93 0x3e 0xa0 0xc8 0x12 0x06 0x9e 0x36 0xd0 0x19 0x01 0xef 0xa4 0xe4 0xde 0x67 0x83 0x16 0x84 0xbf 0x40 0x63 0xe7 0x22 0xc9 0x62 0x0e 0x38 0x56 0xc5 0x56 0xa2 0xc4 0x1a 0x47 0x4c 0xeb 0x9b 0x35 0x85 0x6a 0xb4 0x87 0x18 0x98 0xc2 0x32 0x34 0x21 0xcf 0x68 0x1c 0x54 0x68 0x02 0xe6 0xc4 0x40 0x83 0x58 0x92 0xc9 0x05 0x4b 0x65 0x71 0xd7 0x55 0x05 0xaf 0xdd 0xaf 0x24 0xd8 0x56 0xb0 0x85 0xc5 0xa6 0x91 0xb2 0xb0 0x84 0x62 0xc1 0xb2 0xcd 0xec 0xf8 0xac 0x24 0x72 0xb3 0x33 0x46 0x51 0x03 0xd0 0xdf 0x22 0xba 0x8d 0x65 0xbf 0x99 0x2e 0x2b 0x48 0xa4 0x88 0xaa 0x70 0x4e 0xeb 0x2c 0x40 0xd3 0x5e 0x87 0xa2 0xc0 0x21 0x62 0xf8 0xcb 0x25 0x3b 0x36 0xbb 0x54 0xd8 0x6e 0x3d 0xdf 0x0f 0xcd 0x17 0x3e 0xba 0x4d 0x96 0xf2 0xb3 0xe5 0x00 0x77 0xf3 0xcc 0xb4 0xc6 0x48 0x57 0xe4 0xd2 0x91 0x5a 0xb8 0x7f 0x63 0x3a 0x28 0x0c 0xca 0x0a 0xcd 0x8b 0xa7 0x41 0x62 0x72 0xef 0xb3 0xcb 0xff 0xc1 0xe5 0xff 0x09 0xa9 0x6c 0xae 0x8f 0xcc 0x32 0xe2 0x67 0x62 0xdc 0x9b 0x03 0x1c 0xd4 0xbd 0x5d 0x3a 0x9a 0x5d 0x40 0x8d 0x46 0xf3 0x58 0x17 0x33 0x4d 0xe3 0x46 0x82 0x6e 0x57 0x59 0x5d 0x5b 0x43 0x35 0x96 0xb8 0x72 0x51 0x5e 0x69 0x5b 0x48 0xc2 0x8a 0xc0 0xbb 0xae 0xb9 0x80 0x7f 0x46 0x2a 0x3b 0xf3 0x19 0xfc 0x97 0xdc 0x80 0xba 0x38 0x38 0xf7 0x8c 0x07 0xec 0x85 0x6a 0xfb 0x1b 0xa7 0x6e 0x6c 0x73 0xa9 0xe1 0xd4 0x5c 0x32 0xd5 0xc5 0x27 0xf2 0x99 0x74 0xc4 0x48 0x80 0xd3 0x13 0x53 0x48 0x07 0xed 0x57 0x6c 0x42 0x9b 0xab 0x89 0x6a 0x59 0x4f 0x6e 0x31 0x30 0x02 0x5b 0x68 0x02 0x0c 0xba 0x01 0xfe 0x36 0xac 0x1f 0x9e 0x93 0x5c 0x76 0xbb 0x7f 0x20 0xd3 0x39 0x6b 0xd8 0x72 0x94 0x8d 0x32 0x5f 0xe4 0x82 0xf2 0x36 0x5e 0x45 0xdd 0x50 0x0b 0x41 0xd4 0xb0 0xb0 0xa9 0xe6 0xba 0x3c 0xd8 0x02 0x60 0x60 0x16 0xd0 0x49 0x06 0xec 0x08 0x95 0xf9 0x20 0xa2 0xda 0x3e 0x9f 0x40 0x7b 0xa2 0x16 0x0e 0xf2 0x59 0xfa 0x89 0x0c 0x6c 0x84 0xd9 0x16 0x25 0xca 0x56 0x74 0x46 0x9a 0xa0 0x8d 0xc9 0xc2 0x14 0x88 0xca 0x99 0x3a 0xfe 0x7a 0x89 0x6d 0xa4 0x4f 0x7d 0xe7 0x13 0xef 0xaa 0x2e 0x8c 0xd8 0xcf 0x81 0x92 0xeb 0x18 0x44 0x17 0x53 0x40 0x54 0xf9 0xef 0xfd 0x51 0xc9 0x3e 0xfb 0x30 0x44 0xa0 0x16 0x4a 0x4c 0xcf 0x43 0xc3 0x1a 0x53 0x6b 0x01 0x32 0x64 0xf9 0x4e 0x04 0xf1 0x4d 0x0d 0xaf 0xc4 0x04 0xe6 0x9f 0x0e 0x7b 0xf0 0xb0 0x7d 0xf5 0xdd 0xfe 0xb2 0xc2 0x61 0x86 0xbd 0xfb 0x3e 0xfd 0x49 0x9e 0x6b 0xa9 0x44 0x6f 0x4d 0x2d 0x75 0x2f 0x40 0x8f 0x72 0xf6 0xe7 0xb2 0x55 0x25 0xd9 0xd0 0x4e 0x07 0x18 0x06 0xbb 0x52 0xd3 0x1d 0xd3 0x16 0xa0 0xc1 0x37 0x3c 0xee 0x46 0x38 0x79 0x66 0xa5 0x0e 0xbf 0xe3 0x35 0x87 0x8a 0x06 0x32 0x95 0x39 0x03 0xe5 0xb6 0x29 0x64 0x3d 0xba 0x58 0x96 0x75 0x2a 0x26 0xd7 0x7a 0xb5 0xde 0x45 0x88 0x31 0xc0 0xf0 0xb0 0x76 0x34 0x99 0x3f 0x64 0xa6 0x46 0x7b 0xdb 0x00 0xd5 0x18 0x86 0xaa 0xde 0xe8 0x84 0x4c 0x57 0xa9 0xd1 0xe9 0x89 0xc7 0xfa 0x8a 0x65 0x26 0x21 0xae 0xd6 0x82 0xb0 0x6e 0x6b 0x02 0x31 0xaf 0x69 0x84 0x49 0xb7 0xda 0xce 0x5b 0xe9 0x48 0x15 0x8e 0x82 0x84 0x42 0xde 0x85 0xcc 0xe5 0x51 0xd6 0xfa 0x98 0x7e 0xbb 0x4f 0x61 0x34 0x54 0xe0 0x45 0xa8 0x1c 0x6d 0x7d 0x01 0x14 0x06 0xa7 0x9c 0xb6 0xd1 0x15 0x87 0xa4 0x92 0x6e 0x5a 0x81 0x28 0xc1 0xe4 0x54 0x43 0x8a 0x81 0x72 0x1d 0x85 0x3e 0xe0 0x4a 0x36 0xcd 0x7d 0x74 0x63 0x87 0x08 0xcf 0x13 0xa8 0xf6 0xf6 0x83 0x1e 0x45 0xcc 0x45 0x54 0x3e 0x3a 0x30 0x0a 0x58 0x23 0x4a 0x53 0x6f 0x48 0x54 0x77 0x4a 0x4c 0x32
length: 1388
partOccInTxtBlob_offset: 4625 --> 925
fromOffset_128bytes ( calculated 129 bytes ): 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0x00 0x33 0x54 0x01 0x00 0x00 0x00 0x00 0x00 0x0c 0x1b 0x01 0x03 0x80 0x00 0x00 0x78 0x0a 0x07 0xf5 0x9a 0x56 0x4e 0x86 0x26 0x1e 0x50 0x54 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0x00 0x00 0x00 0xfc 0x00 0x4c 0x53 0x30 0x36 0x30 0x52 0x31 0x53 0x58 0x30 0x31 0x20 0x20 0x00 0x00 0x00 0xff 0x00 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x20 0x20 0x20 0x20 0x20 0x00 0x00 0x00 0xfd 0x00 0x17 0x4b 0x0f 0xf0 0x22 0x00 0x0a 0x20 0x20 0x20 0x20 0x20 0x20 0x01 0x7e
fromOffset_128bytes ( calculated 257 bytes ): 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0x00 0x33 0x54 0x01 0x00 0x00 0x00 0x00 0x00 0x0c 0x1b 0x01 0x03 0x80 0x00 0x00 0x78 0x0a 0x07 0xf5 0x9a 0x56 0x4e 0x86 0x26 0x1e 0x50 0x54 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0x00 0x00 0x00 0xfc 0x00 0x4c 0x53 0x30 0x36 0x30 0x52 0x31 0x53 0x58 0x30 0x31 0x20 0x20 0x00 0x00 0x00 0xff 0x00 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x20 0x20 0x20 0x20 0x20 0x00 0x00 0x00 0xfd 0x00 0x17 0x4b 0x0f 0xf0 0x22 0x00 0x0a 0x20 0x20 0x20 0x20 0x20 0x20 0x01 0x7e 0x02 0x03 0x17 0x74 0x47 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x23 0x09 0x7f 0x07 0x66 0x03 0x0c 0x00 0x30 0x00 0x80 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0xff 0x4f 0xa0 0x96 0x50 0x00 0x10 0xa0 0x46 0x23 0xc2 0x00 0x5a 0xa0 0x00 0x00 0x00 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x8d

Related

Error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not

I'm having an issue when I try to scaffold from my database. I keep getting the same error and I've traid everything. I enabled the TCP/IP port MYSQLEXPRESS, I reestarted de service, I tried changing the connection string on the scaffolding comand...
Here is the error I keep getting:
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder.)
---> System.ComponentModel.Win32Exception (10060): Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder.
at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover, SqlAuthenticationMethod authType)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool)
at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.Open()
at Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerDatabaseModelFactory.Create(DbConnection connection, DatabaseModelFactoryOptions options)
at Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerDatabaseModelFactory.Create(String connectionString, DatabaseModelFactoryOptions options)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluarlize)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:10060,State:0,Class:20
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder.)
My database is located in an external server and I have connected to it by adding a linked server on Microsoft SQL Management Studio:
Here is the command I have been trying on the package manager console:
Scaffold-DbContext "Data Source=82.223.2.171,1433;Initial Catalog=db_crijoya;User ID=user;Password=****” Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Scaffold-DbContext "Server=82.223.2.171;Database=db;User Id=user;Password=****" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Scaffold-DbContext "Server=DESKTOP-M50KV5N\SQLEXPRESS;Database=db_crijoya;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Scaffold-DbContext "Server=CRISOFT;Database=db_crijoya;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
I don't know how to solve it. I can connect properly to the server but I the scaffold command isn't working... Please help
If someone is having the same issue I just solved it.
I have my database in mysql server not sql. I was using on my command the package Microsoft.EntityFrameworkCore.SqlServer so It wouldn't do the scaffolding. I installed MySql.Data.EntityFrameworkCore, although it has fallen into disuse and tried this command:
Scaffold-DbContext "server=82.223.2.171;port=3306;user=user;password=****;database=db" MySql.Data.EntityFrameworkCore -OutputDir Models -f

SqlDataAdapter.Fill method is throws SqlException when the BUILTIN/Administrators language is British English

our c# application uses SqlDataAdapter to fetch data from the DB to present in a report. For some reason the SqlDataAdapter.Fill method is throwing below SqlException when the BUILTIN/Administrators language is British English. When it is English, it is working fine. I debugged my C# code but didn't get a clue why this is happening. Can some one help me overcome this exception?
{System.Data.SqlClient.SqlException (0x80131904): Error converting data type nvarchar to datetime.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at ReportViewer.ReportViewer.CreateReportDataSource(ReportRequest reportRequest, String selectString, ReportParameterInfoCollection parameters, DataSet dataSet, SqlConnection connection) in C:\ISSCode\branches\Samra2Freeze\Controls\ReportViewer\ReportViewer.cs:line 367
ClientConnectionId:fc8c8835-3d91-423e-b467-64c6adf6fecc
Error Number:8114,State:5,Class:16}

JSON Escape character of double quote prints in the string

I'm generating a JSON file using VB6 and one of my strings has a double quote in between. I have used the double quote escape character but now the escape character is also printing in the string, even though the JSON is successful when I put the file in JSON formatter.
The string is:
"productName":"16X12 / 46/4X46 63" DRILL"
This string have a double quote in it when I use escape character and check it the JSON formatter , the JSON is successful but product name string becomes
"productName":"16X12 / 46/4X46 63\"DRILL"
as u can see the escape character is printing in the string before the double quote, How can I escape the double quote without printing the escape character.
I have tried with \ and \\ but every \ get prints.
You need a proper JSON string escaping implementation, e.g. try this
Private Function JsonEscape(sText As String) As String
Const STR_CODES As String = "\u0000|\u0001|\u0002|\u0003|\u0004|\u0005|\u0006|\u0007|\b|\t|\n|\u000B|\f|\r|\u000E|\u000F|\u0010|\u0011|\u0012|\u0013|\u0014|\u0015|\u0016|\u0017|\u0018|\u0019|\u001A|\u001B|\u001C|\u001D|\u001E|\u001F"
Static vTranscode As Variant
Dim lIdx As Long
Dim lAsc As Long
If IsEmpty(vTranscode) Then
vTranscode = Split(STR_CODES, "|")
End If
For lIdx = 1 To Len(sText)
lAsc = AscW(Mid$(sText, lIdx, 1))
If lAsc = 92 Or lAsc = 34 Then '--- \ and "
JsonEscape = JsonEscape & "\" & ChrW$(lAsc)
ElseIf lAsc >= 32 And lAsc < 256 Then
JsonEscape = JsonEscape & ChrW$(lAsc)
ElseIf lAsc >= 0 And lAsc < 32 Then
JsonEscape = JsonEscape & vTranscode(lAsc)
ElseIf Asc(Mid$(sText, lIdx, 1)) <> 63 Or Mid$(sText, lIdx, 1) = "?" Then '--- ?
JsonEscape = JsonEscape & ChrW$(AscW(Mid$(sText, lIdx, 1)))
Else
JsonEscape = JsonEscape & "\u" & Right$("0000" & Hex$(lAsc), 4)
End If
Next
End Function
This takes care of " and \ in strings as well as vbCrLf and other special symbols (charcode < 32). This handles unicode characters too (charcode > 256).
Btw, you'll have to escape all user-supplied strings (either in keys or values) to prevent producing invalid JSON in all cases.

Why point insertion giving error?

I am using this statement to insert data into database.
cursor.execute('INSERT INTO scats_data(id,geometry,NB_SCATS_SITE,QT_INTERVAL_COUNT,NB_DETECTOR,DAY_OF_WEEK,V00,V01,V02,V03,V04,V05,\
V06,V07,V08,V09,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,V20,V21,V22,V23,V24,V25,V26,V27,V28,V29,V30,V31,V32,V33,V34,V35,V36,\
V37,V38,V39,V40,V41,V42,V43,V44,V45,V46,V47,V48,V49,V50,V51,V52,V53,V54,V55,V56,V57,V58,V59,V60,V61,V62,V63,V64,V65,V66,V67,V68,\
V69,V70,V71,V72,V73,V74,V75,V76,V77,V78,V79,V80,V81,V82,V83,V84,V85,V86,V87,V88,V89,V90,V91,V92,V93,V94,V95,DS_LOCATION,NB_LANE,\
LANE_MVT,LOC_MVT,HF,unique_road )' \
'VALUES("%s", ST_GeomFromText("%s"),"%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s",\
"%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s",\
"%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s",\
"%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s",\
"%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s", "%s","%s", "%s",\
"%s", "%s", "%s","%s", "%s", "%s",ST_GeomFromText("%s"))',row)
Now to insert geometry i reffered this link (http://dev.mysql.com/doc/refman/5.7/en/populating-spatial-columns.html) and it says INSERT INTO geom VALUES (ST_GeomFromText('POINT(1 1)'));
In SQL data is stored like this: 6828-1-1418515200000,POINT (142.4685224783753 -38.369480766871604),6828,2014-12-14T00:00:00.000Z
So I think if I think %s will be replaced by ,POINT (142.4685224783753 -38.369480766871604) which is same query as in MySQL tutorial.
But, its giving error IntegrityError: 1048 (23000): Column 'geometry' cannot be null.
row values
6828-1-1418515200000,POINT (142.4685224783753 -38.369480766871604),6828,2014-12-14T00:00:00.000Z,1,Sun,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,2,3,0,1,0,3,3,1,3,1,1,1,0,0,0,1,1,1,0,1,3,0,2,2,1,4,3,2,1,0,1,1,1,6,3,54,0,2,0,1,1,0,3,1,0,1,1,2,2,0,0,1,2,0,0,0,0,1,PRINCES HWY E OF LAVEROCK GRV,1,LEFT,ALL MOVES,11021,"MULTILINESTRING ((142.48801034854367 -38.381874507510574, 142.48570966059145 -38.380847669922076, 142.4834205640538 -38.37982518177907, 142.48163035372713 -38.37813371108973, 142.47989576432153 -38.37638226868625, 142.4780618391024 -38.37456025481361, 142.4777347288131 -38.374223298652254, 142.47742304568112 -38.3739738685488, 142.47712825035373 -38.37374407278146, 142.47577221023352 -38.37300570096153, 142.47481033576847 -38.372453092845404, 142.4740356560262 -38.37205034193404, 142.47280364651544 -38.371564735815014, 142.4694940306536 -38.370177144007, 142.46895950092957 -38.36993346030617, 142.4684829975748 -38.3696658943809, 142.46804910524443 -38.36940724743188, 142.46437932942334 -38.36724871261641, 142.46400949840813 -38.367014127924854, 142.46369738267254 -38.366842233151786, 142.45993341846577 -38.36463147890183, 142.45960729346984 -38.364437887024344))"

Pipe error 40 A network-related or instance-specific error occurred while establishing a connection to SQL Server

This error is odd because I can connect to my server, however during normal use of my application I occasionally will get this error for 15 minutes. Eventually , thing will go back to normal. Shortly after that, the error begin to appear again. I have read many post that claim the issue is with the connectionstring and username/password. However, since I can connect to it sometimes, it cannot be my username and password. Is it possible that my application does not close streams and thus creating a bottleneck? I really have no idea.
{
ExceptionMessage = "The underlying provider failed on Open.";
ExceptionType = "System.Data.Entity.Core.EntityException";
InnerException = {
ExceptionMessage = "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)";
ExceptionType = "System.Data.SqlClient.SqlException";
InnerException = {
ExceptionMessage = "Access is denied";
ExceptionType = "System.ComponentModel.Win32Exception";
Message = "An error has occurred.";
StackTrace = "<null>";
};
Message = "An error has occurred.";
StackTrace = " at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
\n at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
\n at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
\n at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
\n at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
\n at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)
\n at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
\n at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
\n at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
\n at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
\n at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
\n at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
\n at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
\n at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
\n at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
\n at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
\n at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
\n at System.Data.SqlClient.SqlConnection.Open()
\n at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c)
\n at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
\n at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
\n at System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
\n at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
\n at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
\n at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation)
\n at System.Data.Entity.Core.EntityClient.EntityConnection.Open()";
};
Message = "An error has occurred.";
StackTrace = " at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext()
\n--- End of stack trace from previous location where exception was thrown ---
\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()";
}
The problem was I was not closing my socket connections.