What parameter id should be set to tramsation ME43 (display RFQ)

i need to set the parameter id so that upon clicking the RFQ # in the ALV.. it will display the details..

Hi,
also Don't forget to use this <b>CONVERSION_EXIT_ALPHA_INPUT</b>
some times it will be a problem.
data: v_ANFNR type ANFNR.
v_ANFNR = rsselfield-value.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = V_ANFNR
      IMPORTING
        output = V_ANFNR.
SET PARAMETER ID 'ANF' FIELD V_ANFNR.
CALL TRANSACTION 'ME43' AND SKIP FIRST SCREEN.
Regards
vijay

Similar Messages

  • What key fields should i set in DSO extracting data from 2LIS_02_ITM

    hi experts
    i extract data from 2LIS_02_ITM into a DSO, i know the DSO isn't a must, becoz the 2LIS_02_ITM delta type is ABR, but i want to keep the info in change log.
    so, what the key fields should i set in the dso? just ebeln and ebelp is enough?
    hunger for ur advice and thanks a lot!

    If you extract ITM toa DSO you cannot maintain a log of every change....the data will come ....but when the data must be activated the reference of the ebelp ebeln will remain only a single record....if you want to maintain all the data you must create another field in extractor with you can difference all the changes for one single ebelp ebeln...
    Regards

  • What CMYK profile should I set it at for printing in Australia?

    I'm working on a CD album cover and converting the photo from RGB to CMYK, but want to make sure that I have the correct CMYK profile.
    There are various web, Japan, US, and coated options in the colour setting box.
    But I need some guidance as to which one I should be setting this at in Photoshop?
    Thanks
    Kim

    This should get you started: http://www.drevolution.com.au/blog/index.php?id=2683940155866559937
    As mentioned in the article, always best to talk to your printer.

  • NF980 + SLI What Bios settings should be set at for PCIE.

    I currently purchased back in april the 955 BE am3 chip from AMD. I paired that with 4 gig's of mushikin 1600 ddr3 ram  with a latency of 7-7-6-18. I have installed 2 EVGA Geforce 9800 gtx+ SSC editions. Now here my issue, I currently play a brand new MMO called Aion. This board got released right as Aion came out, but at the time I was currently using a m4a79T deluxe, but obviously only utilizing one video card. Aion flew at between 120-130 fps. Now I purchased this board (NF980-65) hooked up everything I did above, again pairing it with Vista 64. I am now utilizing an SLI setup. However on this board my ram is showing much much lower then what it should be. I've read through the forums and will be correcting the ram issue tonight. But now I am curious what the Bios settings should be for PCIE because my frames per second NOW using two cards, has dropped down to , get ready for this 20-50 fps. All drivers are current, and up to date. Everything except the ram is proper and in order. I am wondering if I need to manipulate the Bios for PCIE or something, or what they should be at exactly so that I can utilize this system to its fullest potential. These cards are Nvidia, this board is Nvidia, yet 1 card ran better on a crossfire only board. Please help.

    Quote from: Svet on 02-October-09, 00:34:09
    Install latest VGA drivers ==> http://www.nvidia.com/object/win7_winvista_64bit_191.03_beta.html
    191.03, 2009.09.25
    Also the game "Aion" may not have corespond SLI pro file or to do not support SLI.{contact to game vendor to find out}
    Another tip:
    Apply from Nvidia CP:
    Turn off Vertical sync
    And set SLI Performance mode to: "Force alternate frame rendering 2"
    Apply and re-test.
    The game does not have an SLI profile. However, I should have mentioned, I uninstalled 1 card to kind of recreate my april environment. No change in FPS. Nivida control panel also has a feature to create your own profile if you will, or turn off sli, which I did too, without change. It has the last nvidia drivers of course, as its a brand new build, so it would require brand new drivers. I said that in the initial post. Again, all settings in OS and hardware are proper and in proper order. Thats why I asked about bios to begin with. You cannot setup a new computer with a fresh install and even see the nvidia control panel without installing it first which would be accompanied by the newest nvidia driver install package. Fyi. Also, I tried the additonal tip you mentioned in creation of a profile...Didn't change.
    You seem to know alot about this,I'm honestly impressed. But are you certain my bios settings from the factory are completly correct for an SLI setup?

  • What should I set me screen resolution to in photoshop CC with my late 2009 27" iMac?

    What should I set me screen resolution to in photoshop CC with my late 2009 27" iMac?

    If its native resolution is 2560x1440 then some people do find it marginal with a 27 inch screen, but I'd have thought it workable if you know where everything is.  People are using that screen res on tiny laptops, but to be fair, they are not much liking it with Photoshop.
    I don't know how Retina support works with CC, but I wonder if you could force it on your iMac?
    Any Mac users out there know how Retina support works?

  • Should be set any parameter

    HI all;
    Oracle Express Edition is being engg college data maintenace whenever student login one by one is running succsefull and if all student login at time then it is hang.
    what is solution for this problem
    should be set any parameter

    Find out what operations the login code does. Look at the source code. Get a trace.
    That this is an issue with concurrent updates to the same row is only conjecture on my part. Without knowing what the application actually does.
    Hemant K Chitale

  • What parameters should be set when i receive standard material through idoc

    Hi,
    What parameters should be set when i receive standard material through idoc in inbound system.
    regards,
    Gurprit Bhatia

    http://help.sap.com/saphelp_nw04/helpdata/en/78/21755951ce11d189570000e829fbbd/frameset.htm
    How to understand "outbound parameters" and "inbound parameters" in WE20?

  • What speed should I set my fans to while gaming under windows?

    What speed should I set my fans to while gaming under windows?

    Have you tried using the "Arial Unicode MS"? I saw that "the Arial Unicode font includes support for the Asian languages (Simplified Chinese, Traditional Chinese, Japanese and Korean) as well as for all the languages used in major commercial markets." Let me know if this works.
    Regards,
    Claire Reid
    National Instruments

  • What is the best way to have complete security? Should I set up a VPN? How is that done and information used, if this is a method of further security. Thanks

    Can anyone help me with applying settings for ultimate security and privacy. I like to keep the computer free from clutter and info, cookies, cache etc... Are  there any applications or support I can add to the already wonderful OS. Should I set up a VPN? Any advise or knowledge would be appreciated. Thank you in advance.

    I have read several articles in which it says "the rule of three" meaning three backups , is this for real?
    I don't think you understood the context. It was meant to say that your Time Machine backup drive should be three times the capacity as the drive(s) backed up. If your drive were 100 GBs, then the backup drive for Time Machine should be 300 GBs. In fact it should be at least twice the capacity. More being better.
    I also thought about the cloning aspect but have never used it before.
    Cloned backups differ from Time Machine in that they are fully bootable (which is not the case for Time Machine) and only require a backup drive to be the same size as the drive backed up. Incremental backups simply replace old files with new copies and new files. This requires using third-party backup utilities such as:
    Some Suggested Backup Software
      1. Carbon Copy Cloner
      2. Data Backup
      3. Deja Vu
      4. SuperDuper!
      5. Synk Pro
      6. Tri-Backup
    Others may be found at VersionTracker or MacUpdate.
    Visit The XLab FAQs and read the FAQ on backup and restore.  Also read How to Back Up and Restore Your Files.
    I would also like to use SL as a second OS with this computer , how would I do this without using my internal hd and adding partitions to it as I understand that SL is the only OS that you can boot externally from the new OS's that Apple has used.(Lion/ML)
    Technically, this is a different topic and should have been posted separately.
    Any version of OS X may be installed and booted from an external drive. But, iMacs made after 2009 cannot be started from the retail copy of Snow Leopard. Snow Leopard must be updated to 10.6.8 to boot any of the extant iMacs produced after 2009. This does not apply to the yet released new iMac which will only run Mountain Lion.

  • What version I should set in ZXP package manifest to support PS CC 2014?

    Previously (before PS CC 2014) I had this in manifest.xml file:
    <Host Name="PHXS" Version="[14.0,14.9]" />
    <Host Name="PHSP" Version="[14.0,14.9]" />
    It no longer works with PS CC 2014 - ExtensionManager says that I don't have supported version of PS (for PS CC 2014).
    So I changed it to:
    <Host Name="PHXS" Version="[2014.0,2014.9]" />
    <Host Name="PHSP" Version="[2014.0,2014.9]" />
    But still ExtensionManager does not allow me to install extension for the same reason...
    What version range should be included in package to support PS CC 2014?

    Ask in the deployment/ extensions forums or check the dev center pages. I have no idea what the current requirements are.
    Mylenium

  • What tasks I should select in NWA Configuration Wizard for PI component

    Hello,
    I'm in the stage of setting up the NetWeaver 2004S SR2. I've logged to the Net Weaver Administration console. According to documentation, to properly configure PI component I should execute Configuration Wizard task. The problem is that documentation is not very specific on what exact tasks I should execute, so I would like to get some advise from the community.
    All tasks I can see are:
    BI_00_This wizard will execute Postinstall steps of technical configuration of BI-Java Initial  
    DI_Allinone_This wizard run all post installation steps for DI, CBS, CMS and DTR. Initial  
    DI_CBS_This wizard run all post installation steps for CBS. Initial  
    DI_CMS_This wizard run all post installation steps for CMS. Initial  
    DI_DTR_This wizard run all post installation steps for DTR.
    DI_This wizard sets the Oracle Parameters as per CSN note: 848708 Initial  
    MI_00_This wizard will execute Postinstall steps of technical configuration for the NetWeaver Mobile Infrastructures
    MI_01_This wizard will create User and Assign Dedicated roles  for the NetWeaver Mobile Infrastructure Initial  
    MI_02_create JCo Initial  
    MI_03_create TCP/IP
    MI_04_register Connection Initial  
    MI_05_set profile in ABAP Initial  
    MI_06_schedule MI Job Initial  
    NWA_01_This wizard will execute configuration for local SLD Initial  
    NWA_02_SLD system : Connect SLD to CEN (if CEN present)
    NWA_03_Creating a connection to the SLD and Setting required authorizations for SLD (CIM client settings)
    NWA_04_Creating a connection to the ABAP stack of CEN and Starting heartbeat monitoring Initial  
    NWA_05_NWA system : Store access data per each managed Java system (optional) Initial  
    NWA_06_NWA system : Register each managed ABAP system to SLD Initial  
    NWA_07_creates Destination for Data Supplier Bridge
    PI_00_This wizard will execute Postinstall steps of technical configuration for the PI Usage Initial  
    PI_01_This template checks if the necessary services are started Initial  
    PI_02_This wizard will test the BAPI call to SWF_XI_BPM_AUTO_CUSTOMIZE Initial  
    PI_03_This wizard will assign the Application roles Initial  
    PI_04_This wizard will Maintain_Technical_System
    PI_05_This wizard will configure the integration server for sld Initial  
    PI_06_This wizard will create the necessary Destinations in ABAP Initial  
    PI_07_Create_RFC_Destinations_in_Java Initial  
    PI_08_This wizard will Maintain Http Destination Initial  
    PI_09_This wizard will configure Role of Integration server
    PI_07_Create_RFC_Destinations_in_Java Initial  
    PI_08_This wizard will Maintain Http Destination Initial  
    PI_09_This wizard will configure Role of Integration server Initial  
    PI_10_This wizard will Register_Queues_NA Initial  
    PI_11_This template services are started
    I guess I need to mandatory execute PI_XX tasks, but what about others - do I need to execute anything else (I need only PI component to be installed and configured)? Not sure if that makes any difference, but this is the very first time I get into the NWA, so no previous configuration tasks were executed from the Configuration Wizard.
    My full system configuration: NetWeaver 2004S SR2 ABAP+Java, Windows 2003 32-bit with MS SQL Server 2005.
    Thanks in advance.

    Hi Maxim,
    Please follow this procedure:
    1) Using Config tool Modify VM setting as per requirement (OS and H/W Dependent) Refer note 723909 Java VM settings for J2EE 6.40/7.0.
    2) To set Environmental Variable refer Note 314530 - Number of RFC/CPIC connections for external clients. These parameter should be taken care while installing templates
    Set these:
         1) gw/max_conn 2000
         2) gw/max_sys 1200
         3) gw/max_overflow_size 40000000
         4) gw/max_shm_req 200 (this is to adjust the memory   allocation)
    Profile parameters
    rdisp/tm_max_no 5000
    rdisp/max_comm_entries 200
    ITS
    CPIC_MAX_CONV 5000(Should be taken care that it should be set for <sid>adm user
    3) Installing Template
    Go to home page
    http://hostname:portnumber/webdynpro/dispatcher/
    Click Deploy and change
    4) After This Click Configuration tab and then click Install
    For the next tab select scenario PI
    And configure template and finally install
    5) In case you face any problem while importing please read these notes for altering parameters
    Note 314530 - Number of RFC/CPIC connections for external clients
    Note 923359 - Collective Note: Configuration Wizard - Template Installer
    Hope it will Help you at this stage at development stage
    You need to import SAP BASIS Software Component Version into Integration Repository based on your SP Level & XI or PI.
    You need to download it from [service market place.|https://websmp205.sap-ag.de/~form/handler?_APP=00200682500000001943&_EVENT=SEARCH&HIDE=&SEARCH_SPAT=X&SEARCH_BPAT=X&SEARCH_CD=X&SEARCH_P=X&SEARCH_PV=X&SEARCH_C=X&SEARCH_CV=X&SEARCH_TA=&SEARCH_V=&HIDE_EXPERT_SEARCH=X&SEARCH_MAX_RESULT=20 ]
    Regards,
    Gagan Deep Kaushal

  • Why should i set  global_name=*'TRUE'*

    if I create public database link its should be TRUE, What's the logic here ?
    SQL>show parameter global_name;
    NAME TYPE VALUE
    global_names boolean FALSE
    SQL>create public database link mydba connect to scott identified by tiger using 'ORCL';
    Database link created.
    SQL> select * from emp@mydba
    select count(*) from emp@mydba;
    COUNT(*)
    14
    Even i set global_name='FALSE' i can create public database link. then
    why should i set global_name=*'TRUE'*

    >
    if I create public database link its should be TRUE, What's the logic here ?
    >
    Says who? That isn't true at all. You don't have to see it to TRUE
    >
    Even i set global_name='FALSE' i can create public database link. then
    why should i set global_name=*'TRUE'*
    >
    You do NOT have to set it to true but you can if you want your links to have the same name as the DB they connect to.
    http://docs.oracle.com/cd/B28359_01/server.111/b28320/initparams088.htm
    See the Database Reference
    >
    GLOBAL_NAMES specifies whether a database link is required to have the same name as the database to which it connects.
    If the value of GLOBAL_NAMES is false, then no check is performed. If you use or plan to use distributed processing, then Oracle recommends that you set this parameter to true to ensure the use of consistent naming conventions for databases and links in a networked environment.
    >
    The CREATE DATABASE LINK section of the SQL Language Doc tells you what that setting means.
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_5005.htm
    >
    If the value of the GLOBAL_NAMES initialization parameter is TRUE, then the database link must have the same name as the database to which it connects. If the value of GLOBAL_NAMES is FALSE, and if you have changed the global name of the database, then you can specify the global name.
    >
    If global_name is TRUE then, as the doc says, 'the database link must have the same name as the database to which it connection.

  • How much OPTIMIZER_INDEX_CACHING and OPTIMIZER_INDEX_COST_ADJ should I set?

    Dear all:
    I use CBO and the default parameter of the "OPTIMIZER_INDEX_CACHING" is 0 and "OPTIMIZER_INDEX_COST_ADJ" is 100 these two parameters will impact of CBO. how much OPTIMIZER_INDEX_CACHING should I set?
    my environment is Oracle 9.2.0.8 (64bit)
    Regards
    Terry

    Terry Chen wrote:
    Dear Nicolas:
    Thank you for your quick reply, I have to say I have to modify the default setting of these parameters ,because we use EBS 11.5.9 and the database is more powerful then ever before and the SQL explain plan still show to do sorting with high cost.So I think I will refer to the articles of the provided and find the answers.
    Before you start playing around with these parameters, have you checked very carefully that you are conforming to the suggestions offered for all the parameters listed in the installation notes for EBS, and doing what you're supposed to do with system statistics ?
    Regards
    Jonathan Lewis

  • What every developer should know about bitmaps

    This isn't everything, but it is a good place to start if you are about to use bitmaps in your program. Original article (with bitmaps & nicer formatting) at Moderator edit: link removed
    Virtually every developer will use bitmaps at times in their programming. Or if not in their programming, then in a website, blog, or family photos. Yet many of us don't know the trade-offs between a GIF, JPEG, or PNG file – and there are some major differences there. This is a short post on the basics which will be sufficient for most, and a good start for the rest. Most of this I learned as a game developer (inc. Enemy Nations) where you do need a deep understanding of graphics.
    Bitmaps fundamentally store the color of each pixel. But there are three key components to this:
    1.Storing the color value itself. Most of us are familiar with RGB where it stores the Red, Green, & Blue component of each color. This is actually the least effective method as the human eye can see subtle differences on some parts of the color spectrum more than others. It's also inefficient for many common operations on a color such as brightening it. But it is the simplest for the most common programming tasks and so has become the standard.
    2.The transparency of each pixel. This is critical for the edge of non-rectangular images. A diagonal line, to render best, will be a combination of the color from the line and the color of the underlying pixel. Each pixel needs to have its level of transparency (or actually opacity) set from 0% (show the underlying pixel) to 100% (show just the pixel from the image).
    3.The bitmap metadata. This is informat about the image which can range from color tables and resolution to the owner of the image.
    Compression
    Bitmaps take a lot of data. Or to be more exact, they can take up a lot of bytes. Compression has been the main driver of new bitmap formats over the years. Compression comes in three flavors, palette reduction, lossy & lossless.
    In the early days palette reduction was the most common approach. Some programs used bitmaps that were black & white, so 1 bit per pixel. Now that's squeezing it out. And into the days of Windows 3.1 16 color images (4 bits/pixel) were still in widespread use. But the major use was the case of 8-bits/256 colors for a bitmap. These 256 colors would map to a palette that was part of the bitmap and that palette held a 24-bit color for each entry. This let a program select the 256 colors out of the full spectrum that best displayed the picture.
    This approach was pretty good and mostly failed for flat surfaces that had a very slow transition across the surface. It also hit a major problem early on with the web and windowed operating systems – because the video cards were also 8-bit systems with a single palette for the entire screen. That was fine for a game that owned the entire screen, but not for when images from different sources shared the screen. The solution to this is a standard web palette was created and most browsers, etc. used that palette if there was palette contention.
    Finally, there were some intermediate solutions such as 16-bits/pixel which did provide the entire spectrum, but with a coarse level of granularity where the human eye could see jumps in shade changes. This found little usage because memory prices dropped and video cards jumped quickly from 8-bit to 24-bit in a year.
    Next is lossy compression. Compression is finding patterns that repeat in a file and then in the second case just point back to the first run. What if you have a run of 20 pixels where the only difference in the second run is two of the pixels are redder by a value of 1? The human eye can't see that difference. So you change the second run to match the first and voila, you can compress it. Most lossy compression schemes let you set the level of lossiness.
    This approach does have one serious problem when you use a single color to designate transparency. If that color is shifted by a single bit, it is no longer transparent. This is why lossy formats were used almost exclusively for pictures and never in games.
    Finally comes lossless. This is where the program compresses the snot out of the image with no loss of information. I'm not going to dive into what/how of this except to bring up the point that compressing the images takes substantially more time than decompressing them. So displaying compressed images – fast. Compressing images – not so fast. This can lead to situations where for performance reasons you do not want to store in a lossless format on the fly.
    Transparency
    Transparency comes in three flavors. (If you know an artist who creates web content – have them read this section. It's amazing the number who are clueless on this issue.) The first flavor is none – the bitmap is a rectangle and will obscure every pixel below it.
    The second is a bitmap where a designated color value (most use magenta but it can be any color) means transparent. So other colors are drawn and the magenta pixels are not drawn so the underlying pixel is displayed. This requires rendering the image on a selected background color and the edge pixels that should be partially the image and partially the background pixel then are partially the background color. You see this in practice with 256 color icons where they have perfect edges on a white background yet have a weird white halo effect on their edges on a black background.
    The third flavor is 8 bits of transparency (i.e. 256 values from 0 – 100%) for each pixel. This is what is meant by a 32-bit bitmap, it is 24-bits of color and 8 bits of transparency. This provides an image that has finer graduations than the human eye can discern. One word of warning when talking to artists – they can all produce "32-bit bitmaps." But 95% of them produce ones where every pixel is set to 100% opacity and are clueless about the entire process and the need for transparency. (Game artists are a notable exception – they have been doing this forever.) For a good example of how to do this right take a look at Icon Experience – I think their bitmaps are superb (we use them in AutoTag).
    Resolution
    Many formats have a resolution, normally described as DPI (Dots Per Inch). When viewing a photograph this generally is not an issue. But take the example of a chart rendered as a bitmap. You want the text in the chart to be readable, and you may want it to print cleanly on a 600 DPI printer, but on the screen you want the 600 dots that take up an inch to display using just 96 pixels. The resolution provides this ability. The DPI does not exist in some formats and is optional in others (note: it is not required in any format, but it is unusual for it to be missing in PNG).
    The important issue of DPI is that when rendering a bitmap the user may want the ability to zoom in on and/or to print at the printer's resolution but display at a lower resolution – you need to provide the ability for the calling program to set the DPI. There's a very powerful charting program that is useless except for standard viewing on a monitor – because it renders at 96 DPI and that's it. Don't limit your uses.
    File formats
    Ok, so what file formats should you use? Let's go from most to least useful.
    PNG – 32-bit (or less), lossless compression, small file sizes – what's not to like. Older versions of some browsers (like Internet Explorer) would display the transparent pixels with an off-white color but the newer versions handle it properly. Use this (in 32-bit mode using 8 bits for transparency) for everything.
    ICO – This is the icon file used to represent applications on the desktop, etc. It is a collection of bitmaps which can each be of any resolution and bit depth. For these build it using just 32-bit png files from 16x16 up to 256x256. If your O/S or an application needs a lesser bit depth, it will reduce on the fly – and keep the 8 bits of transparency.
    JPEG – 24-bit only (i.e. no transparency), lossy, small file sizes. There is no reason to use this format unless you have significant numbers of people using old browsers. It's not a bad format, but it is inferior to PNG with no advantages.
    GIF – 8-bit, lossy, very small file sizes. GIF has two unique features. First, you can place multiple GIF bitmaps in a single file with a delay set between each. It will then play through those giving you an animated bitmap. This works on every browser back to the 0.9 versions and it's a smaller file size than a flash file. On the flip side it is only 8 bits and in today's world that tends to look poor (although some artists can do amazing things with just 8 bits). It also has a set color as transparent so it natively supports transparency (of the on/off variety). This is useful if you want animated bitmaps without the overhead of flash or if bandwidth is a major issue.
    BMP (also called DIB) – from 1 up to 32-bit, lossless, large file sizes. There is one case to use this – when speed is the paramount issue. Many 2-D game programs, especially before the graphics cards available today, would store all bitmaps as a BMP/DIB because no decompression was required and that time saving is critical when you are trying to display 60 frames/second for a game.
    TIFF – 32-bit (or less), lossless compression, small file sizes – and no better than PNG. Basically the government and some large companies decided they needed a "standard" so that software in the future could still read these old files. This whole argument makes no sense as PNG fits the bill. But for some customers (like the federal government), it's TIFF instead of PNG. Use this when the customer requests it (but otherwise use PNG).
    Everything Else – Obsolete. If you are creating a bitmap editor then by all means support reading/writing every format around. But for other uses – stick to the 2+4 formats above.
    Edited by: 418479 on Dec 3, 2010 9:54 AM
    Edited by: Darryl Burke -- irrelevant blog link removed

    I don't think the comment about jpeg being inferior to png and having no advantages is fair. The advantage is precisely the smaller file sizes because of lossy compression. Saving an image at 80-90% quality is virtually indistinguishable from a corresponding png image and can be significantly smaller in file size. Case in point, the rocket picture in that blog post is a jpeg, as is the picture of the blogger.
    The statements about the TIFF format is slightly wrong. TIFF is sort of an all encompassing format that's not actually associated with any specific compression. It can be lossless, lossy, or raw. You can have jpeg, jpeg2000, lzw, packbits, or deflate (png) compressed tiff files. There's also a few compressions that specialize in binary images (used alot for faxes). In fact, the tiff format has a mechanism that allows you to use your own undefined compression. This flexibility comes at a price: not all image viewers can open a tiff file, and those that do may not be able to open all tiff files.
    Ultimately though, the main reason people use TIFF is because of its multipage support (like a pdf file), because of those binary compressions (for faxes), and because of its ability include virtually any metadata about the image you want (ex: geographical information in a "GeoTIFF").

  • What every developer should know about character encoding

    This was originally posted (with better formatting) at Moderator edit: link removed/what-every-developer-should-know-about-character-encoding.html. I'm posting because lots of people trip over this.
    If you write code that touches a text file, you probably need this.
    Lets start off with two key items
    1.Unicode does not solve this issue for us (yet).
    2.Every text file is encoded. There is no such thing as an unencoded file or a "general" encoding.
    And lets add a codacil to this – most Americans can get by without having to take this in to account – most of the time. Because the characters for the first 127 bytes in the vast majority of encoding schemes map to the same set of characters (more accurately called glyphs). And because we only use A-Z without any other characters, accents, etc. – we're good to go. But the second you use those same assumptions in an HTML or XML file that has characters outside the first 127 – then the trouble starts.
    The computer industry started with diskspace and memory at a premium. Anyone who suggested using 2 bytes for each character instead of one would have been laughed at. In fact we're lucky that the byte worked best as 8 bits or we might have had fewer than 256 bits for each character. There of course were numerous charactersets (or codepages) developed early on. But we ended up with most everyone using a standard set of codepages where the first 127 bytes were identical on all and the second were unique to each set. There were sets for America/Western Europe, Central Europe, Russia, etc.
    And then for Asia, because 256 characters were not enough, some of the range 128 – 255 had what was called DBCS (double byte character sets). For each value of a first byte (in these higher ranges), the second byte then identified one of 256 characters. This gave a total of 128 * 256 additional characters. It was a hack, but it kept memory use to a minimum. Chinese, Japanese, and Korean each have their own DBCS codepage.
    And for awhile this worked well. Operating systems, applications, etc. mostly were set to use a specified code page. But then the internet came along. A website in America using an XML file from Greece to display data to a user browsing in Russia, where each is entering data based on their country – that broke the paradigm.
    Fast forward to today. The two file formats where we can explain this the best, and where everyone trips over it, is HTML and XML. Every HTML and XML file can optionally have the character encoding set in it's header metadata. If it's not set, then most programs assume it is UTF-8, but that is not a standard and not universally followed. If the encoding is not specified and the program reading the file guess wrong – the file will be misread.
    Point 1 – Never treat specifying the encoding as optional when writing a file. Always write it to the file. Always. Even if you are willing to swear that the file will never have characters out of the range 1 – 127.
    Now lets' look at UTF-8 because as the standard and the way it works, it gets people into a lot of trouble. UTF-8 was popular for two reasons. First it matched the standard codepages for the first 127 characters and so most existing HTML and XML would match it. Second, it was designed to use as few bytes as possible which mattered a lot back when it was designed and many people were still using dial-up modems.
    UTF-8 borrowed from the DBCS designs from the Asian codepages. The first 128 bytes are all single byte representations of characters. Then for the next most common set, it uses a block in the second 128 bytes to be a double byte sequence giving us more characters. But wait, there's more. For the less common there's a first byte which leads to a sersies of second bytes. Those then each lead to a third byte and those three bytes define the character. This goes up to 6 byte sequences. Using the MBCS (multi-byte character set) you can write the equivilent of every unicode character. And assuming what you are writing is not a list of seldom used Chinese characters, do it in fewer bytes.
    But here is what everyone trips over – they have an HTML or XML file, it works fine, and they open it up in a text editor. They then add a character that in their text editor, using the codepage for their region, insert a character like ß and save the file. Of course it must be correct – their text editor shows it correctly. But feed it to any program that reads according to the encoding and that is now the first character fo a 2 byte sequence. You either get a different character or if the second byte is not a legal value for that first byte – an error.
    Point 2 – Always create HTML and XML in a program that writes it out correctly using the encode. If you must create with a text editor, then view the final file in a browser.
    Now, what about when the code you are writing will read or write a file? We are not talking binary/data files where you write it out in your own format, but files that are considered text files. Java, .NET, etc all have character encoders. The purpose of these encoders is to translate between a sequence of bytes (the file) and the characters they represent. Lets take what is actually a very difficlut example – your source code, be it C#, Java, etc. These are still by and large "plain old text files" with no encoding hints. So how do programs handle them? Many assume they use the local code page. Many others assume that all characters will be in the range 0 – 127 and will choke on anything else.
    Here's a key point about these text files – every program is still using an encoding. It may not be setting it in code, but by definition an encoding is being used.
    Point 3 – Always set the encoding when you read and write text files. Not just for HTML & XML, but even for files like source code. It's fine if you set it to use the default codepage, but set the encoding.
    Point 4 – Use the most complete encoder possible. You can write your own XML as a text file encoded for UTF-8. But if you write it using an XML encoder, then it will include the encoding in the meta data and you can't get it wrong. (it also adds the endian preamble to the file.)
    Ok, you're reading & writing files correctly but what about inside your code. What there? This is where it's easy – unicode. That's what those encoders created in the Java & .NET runtime are designed to do. You read in and get unicode. You write unicode and get an encoded file. That's why the char type is 16 bits and is a unique core type that is for characters. This you probably have right because languages today don't give you much choice in the matter.
    Point 5 – (For developers on languages that have been around awhile) – Always use unicode internally. In C++ this is called wide chars (or something similar). Don't get clever to save a couple of bytes, memory is cheap and you have more important things to do.
    Wrapping it up
    I think there are two key items to keep in mind here. First, make sure you are taking the encoding in to account on text files. Second, this is actually all very easy and straightforward. People rarely screw up how to use an encoding, it's when they ignore the issue that they get in to trouble.
    Edited by: Darryl Burke -- link removed

    DavidThi808 wrote:
    This was originally posted (with better formatting) at Moderator edit: link removed/what-every-developer-should-know-about-character-encoding.html. I'm posting because lots of people trip over this.
    If you write code that touches a text file, you probably need this.
    Lets start off with two key items
    1.Unicode does not solve this issue for us (yet).
    2.Every text file is encoded. There is no such thing as an unencoded file or a "general" encoding.
    And lets add a codacil to this – most Americans can get by without having to take this in to account – most of the time. Because the characters for the first 127 bytes in the vast majority of encoding schemes map to the same set of characters (more accurately called glyphs). And because we only use A-Z without any other characters, accents, etc. – we're good to go. But the second you use those same assumptions in an HTML or XML file that has characters outside the first 127 – then the trouble starts. Pretty sure most Americans do not use character sets that only have a range of 0-127. I don't think I have every used a desktop OS that did. I might have used some big iron boxes before that but at that time I wasn't even aware that character sets existed.
    They might only use that range but that is a different issue, especially since that range is exactly the same as the UTF8 character set anyways.
    >
    The computer industry started with diskspace and memory at a premium. Anyone who suggested using 2 bytes for each character instead of one would have been laughed at. In fact we're lucky that the byte worked best as 8 bits or we might have had fewer than 256 bits for each character. There of course were numerous charactersets (or codepages) developed early on. But we ended up with most everyone using a standard set of codepages where the first 127 bytes were identical on all and the second were unique to each set. There were sets for America/Western Europe, Central Europe, Russia, etc.
    And then for Asia, because 256 characters were not enough, some of the range 128 – 255 had what was called DBCS (double byte character sets). For each value of a first byte (in these higher ranges), the second byte then identified one of 256 characters. This gave a total of 128 * 256 additional characters. It was a hack, but it kept memory use to a minimum. Chinese, Japanese, and Korean each have their own DBCS codepage.
    And for awhile this worked well. Operating systems, applications, etc. mostly were set to use a specified code page. But then the internet came along. A website in America using an XML file from Greece to display data to a user browsing in Russia, where each is entering data based on their country – that broke the paradigm.
    The above is only true for small volume sets. If I am targeting a processing rate of 2000 txns/sec with a requirement to hold data active for seven years then a column with a size of 8 bytes is significantly different than one with 16 bytes.
    Fast forward to today. The two file formats where we can explain this the best, and where everyone trips over it, is HTML and XML. Every HTML and XML file can optionally have the character encoding set in it's header metadata. If it's not set, then most programs assume it is UTF-8, but that is not a standard and not universally followed. If the encoding is not specified and the program reading the file guess wrong – the file will be misread.
    The above is out of place. It would be best to address this as part of Point 1.
    Point 1 – Never treat specifying the encoding as optional when writing a file. Always write it to the file. Always. Even if you are willing to swear that the file will never have characters out of the range 1 – 127.
    Now lets' look at UTF-8 because as the standard and the way it works, it gets people into a lot of trouble. UTF-8 was popular for two reasons. First it matched the standard codepages for the first 127 characters and so most existing HTML and XML would match it. Second, it was designed to use as few bytes as possible which mattered a lot back when it was designed and many people were still using dial-up modems.
    UTF-8 borrowed from the DBCS designs from the Asian codepages. The first 128 bytes are all single byte representations of characters. Then for the next most common set, it uses a block in the second 128 bytes to be a double byte sequence giving us more characters. But wait, there's more. For the less common there's a first byte which leads to a sersies of second bytes. Those then each lead to a third byte and those three bytes define the character. This goes up to 6 byte sequences. Using the MBCS (multi-byte character set) you can write the equivilent of every unicode character. And assuming what you are writing is not a list of seldom used Chinese characters, do it in fewer bytes.
    The first part of that paragraph is odd. The first 128 characters of unicode, all unicode, is based on ASCII. The representational format of UTF8 is required to implement unicode, thus it must represent those characters. It uses the idiom supported by variable width encodings to do that.
    But here is what everyone trips over – they have an HTML or XML file, it works fine, and they open it up in a text editor. They then add a character that in their text editor, using the codepage for their region, insert a character like ß and save the file. Of course it must be correct – their text editor shows it correctly. But feed it to any program that reads according to the encoding and that is now the first character fo a 2 byte sequence. You either get a different character or if the second byte is not a legal value for that first byte – an error.
    Not sure what you are saying here. If a file is supposed to be in one encoding and you insert invalid characters into it then it invalid. End of story. It has nothing to do with html/xml.
    Point 2 – Always create HTML and XML in a program that writes it out correctly using the encode. If you must create with a text editor, then view the final file in a browser.
    The browser still needs to support the encoding.
    Now, what about when the code you are writing will read or write a file? We are not talking binary/data files where you write it out in your own format, but files that are considered text files. Java, .NET, etc all have character encoders. The purpose of these encoders is to translate between a sequence of bytes (the file) and the characters they represent. Lets take what is actually a very difficlut example – your source code, be it C#, Java, etc. These are still by and large "plain old text files" with no encoding hints. So how do programs handle them? Many assume they use the local code page. Many others assume that all characters will be in the range 0 – 127 and will choke on anything else.
    I know java files have a default encoding - the specification defines it. And I am certain C# does as well.
    Point 3 – Always set the encoding when you read and write text files. Not just for HTML & XML, but even for files like source code. It's fine if you set it to use the default codepage, but set the encoding.
    It is important to define it. Whether you set it is another matter.
    Point 4 – Use the most complete encoder possible. You can write your own XML as a text file encoded for UTF-8. But if you write it using an XML encoder, then it will include the encoding in the meta data and you can't get it wrong. (it also adds the endian preamble to the file.)
    Ok, you're reading & writing files correctly but what about inside your code. What there? This is where it's easy – unicode. That's what those encoders created in the Java & .NET runtime are designed to do. You read in and get unicode. You write unicode and get an encoded file. That's why the char type is 16 bits and is a unique core type that is for characters. This you probably have right because languages today don't give you much choice in the matter.
    Unicode character escapes are replaced prior to actual code compilation. Thus it is possible to create strings in java with escaped unicode characters which will fail to compile.
    Point 5 – (For developers on languages that have been around awhile) – Always use unicode internally. In C++ this is called wide chars (or something similar). Don't get clever to save a couple of bytes, memory is cheap and you have more important things to do.
    No. A developer should understand the problem domain represented by the requirements and the business and create solutions that appropriate to that. Thus there is absolutely no point for someone that is creating an inventory system for a stand alone store to craft a solution that supports multiple languages.
    And another example is with high volume systems moving/storing bytes is relevant. As such one must carefully consider each text element as to whether it is customer consumable or internally consumable. Saving bytes in such cases will impact the total load of the system. In such systems incremental savings impact operating costs and marketing advantage with speed.

Maybe you are looking for

  • I am Having a Nightmare!!

    Hi I would really appreciate some help! I just got a new 5th gen black 30GB ipod yesterday and I am having major issues trying to get it to work. I have an ipod mini and so all my updates where completely up to date and so I connected this new ipod t

  • HP LaserJet 4 Postscript driver on Intel MacBook Pro

    I have an HP Laserjet 4M printer (with a JetDirect card) on my network. On my other Macs (PowerBook G4, PowerMac G4, Mac Mini PPC) all running 10.4 I set the printer up and was able to use the 'HP Laserjet 4/4M PostScript' (v1.1.0.X) driver. The supp

  • UCM service call

    Hi,in my custom component of java classes i want to use m_service.executeService("CHECKIN_NEW_SUB"); But how i should write java class for that ... if anyone can plz help me out..with some code or docs. Thanks

  • DSC alarms are blinking when they shouldn't

    I have a bunch of shared variables on my front panel.  Some of them have alarming enabled, with the option to blink when alarming.  I programmatically disable all alarms at startup of the VI, but some of them blink when there is a value of zero for t

  • Problems punching in...

    I am having problems figuring out how to punch in. I turned the cycle button on, selected the spot I wanted to replace, recorded and then stopped recording. It asked which take I wanted and when I selected the take, it erased everything on the track